Opened 6 years ago

Closed 6 years ago

#1806 closed bug (fixed)

OSM: Boundary search very slow when not logged in

Reported by: planetcruiser Owned by:
Priority: blocker Milestone: 1.2
Component: BW Geo Keywords:
Cc: toub, jsfan



  • When not logged in a "Search using map boundaries" causes very high MySQL load
  • It will take several minutes when zoomed out to see the whole world (don't do it!)
  • It will take several seconds when zooming to a busy country like France or Poland (try Poland, it won't slow down the server so much)


  1. Log out
  2. Go to
  3. Search for "Poland"
  4. Press "Search using map boundaries"
  5. It will take about 30 seconds until a result appears - something like "34 found (log in to see 803 more)"
  6. Pressing again will be faster, probably because of MySQL cache


  • Actually for Germany a form based search also already takes very long (almost a minute)
  • We should debug the MySQL queries on the server, or locally
  • MySQL CPU consumption is more than 100% according to top for the whole time until page response

Change History (5)

comment:1 Changed 6 years ago by jsfan

The only difference between logged in and not logged in should be the code I introduced to fix #1557. I'll have a look at this in the next couple of days.

comment:2 Changed 6 years ago by jsfan

This is a really bizarre bug. There is only one extra query for visitors who aren't logged in. I've played with this query and no change seems to matter. Even if I run the same query with just one extra condition and the memberspublic table added, the search takes an estimated factor of 4-5 longer than on the original query. :(

comment:3 Changed 6 years ago by jsfan

Found it. Sometimes it makes sense to pay attention to detail. The memberspublicprofiles table was still included in the COUNT query even though it wasn't used. I suspect that messed up the indexing.

Please test and close.

Last edited 6 years ago by jsfan (previous) (diff)

comment:4 Changed 6 years ago by mahouni

works fine!

comment:5 Changed 6 years ago by globetrotter_tt

  • Resolution set to fixed
  • Status changed from new to closed

Nice one :)

Tested search while logged out with France, Germany and World. I got all results in less than 2 seconds.

Note: See TracTickets for help on using tickets.