[OSM-dev] Anyone with a speedy gazetteer

David Earl david at frankieandshadow.com
Mon Jan 12 17:26:53 GMT 2009


On 12/01/2009 15:54, Tom Hughes wrote:
> David Earl wrote:
>> (b) do updates on different tables to queries and switch them over on 
>> completion.
...
> 
> The main problem with b is that you need to make a complete copy of the 
> tables before you start the update - the logic presumably goes like this:
> 
>    - Copy live_database to temp_database
> 
>    - Update temp_database
> 
>    - Delete live_database
> 
>    - Rename temp_database to live_database
> 
> or have I misunderstood?

There are two copies (but only of the tables that support search, not 
those that are needed only to support the update). Let's call them A and 
B. But you don't need to make a copy on each update

A services queries.

B applies an update U1

On completion they are switched so that B services queries.

Then A applies U1 and a new update U2.

On completion they switch, A services queries.

B applies U2 and a new update U3

and so on.

So there's no copy involved on each cycle, but you do have to apply each 
update to both. Two updates are cheaper to apply together than doing 
them consecutively, but doing them both twice is still more costly than 
doing each once on consecutive days.

Also I was thinking I'd switch (search) tables within one database, 
rather than separate database.

David




More information about the dev mailing list