I have set up Nominatim in a virtual machine importing the US data. The setup seemed to go fine but when I search for something, anything, in the Nominatim page (i.e. http://<nominatim_server>/nominatim) it takes too long. Too long is minutes. For example for simple searches like ‘miami’ or ‘seattle’ it takes around 1:30 minutes. For more detailed searches like ‘1600 Pennsylvania Ave NW, Washington, DC 20500, USA’ it takes up to 8 minutes.
This VM has 250GB of disk space, 4 GB of RAM and 1 processor.
I have successfully performed the very same Nominatim installation on a “real” server with 8 core processors and plenty of RAM and disk space. So I thought the bottleneck had to be the VM’s resources. When I perform a search the CPU is 100% busy. So I increased the RAM to 8GB and the processors to 2 and then 4, and surprisingly the tests not only did not improve but in some cases got worse, not sure why (??!!).
So now I am thinking the bottleneck has to be in the Nominatim DB. I wanted to obtain the SQL that is run against the DB when I perform a search but my problem is that I don’t know how to capture that. All I have is the URL generated by the site, but I don’t know how to translate that into SQL. I can’t find any Nominatim log where that info would be saved, or anything like that. I have googled it but there does not seem to be much info about it.
So how can I capture the SQL being run against the Nominatim DB when I perform a search in my Nominatim page? Any other troubleshooting tips perhaps? I read somewhere that the cause could be an index not being created when the DB was created. But I compared in PGAdmin the DB that works and the DB that does not work and they seem identical -though I have not compared every single table, trigger, function, etc., so I am not entirely sure. Of course I want to avoid if possible re-installing Nominatim from scratch.
BTW I am far from being a Ubuntu/OSM/Nominatim expert so please reply as you would to your 90-year-old, half-deaf, illiterate grandma.
Thanks for your help.