I think this is curious enough to be posted somewhere.
We're running an OpenStreetMap tileserver at osm.trail.pl with a very nice mapnik style designed by my friend. We have been rendering only a single country area until recently and decided to expand to the full planet. After a couple of weeks of occasionally wrestling with the amount of data in postgres after the planet import, we now have it running the first update from hourly diffs. It has about three weeks worth of diffs to catch up with but it's on the right track. It's still going to take three or four days.
In the meantime I decided to create a new database and reimport the geofabrik country extract that we had been using before, because people started complaining about lack of updates. The import only takes some 20 minutes. Now this database has only some 8 hours of diffs to catch up with OSM, but osm2pgsql was crawling when I launched it, and it looked like this tiny update was going to take about a week. I tried to find the query which was taking so long by SELECTing from pg_stat_activity. The culpable query seems to have been UPDATE planet_osm_ways .. WHERE nodes && ARRAY[$1] ..; I ran the query with \timing on and it showed about 10s to execute on the country extract. I ran the same query on the planet database and it took 0.4s. EXPLAIN showed that on the country extract database it was using a sequential scan instead of using the planet_osm_ways_nodes index. I learnt about disabling sequential scans with SET enable_seqscan = 0; but it kept using sequential scan anyway. When strange things happen with postgresql there's usually one person in #postgresql who can explain it, his nick is RhodiumToads. And he did explain, and the explanation is this: