zerebubuth / openstreetmap-cgimap

A C++ implementation of the OpenStreetMap API map call.
http://wiki.openstreetmap.org/wiki/Cgimap
GNU General Public License v2.0
74 stars 38 forks source link

libpqxx: cache column names #383

Closed mmd-osm closed 8 months ago

mmd-osm commented 8 months ago

From libpqxx docs:

pqxx::field pqxx::row::at (const char f[]) const Warning: This is much slower than indexing by number, or iterating.

Without caching, we're repeatedly calling PQfnumber for each row/field, which does a strcmp across all column names. Since our queries don't return a huge number of columns, this was not too bad before.