[postgis-users] Indexes

Graham Glanfield graham.glanfield at geocento.com
Wed May 28 10:29:50 PDT 2014


Hi folks,

I have streaming replication running between one master and a few slaves 
(Fedorax_86_64 - PostgreSQL 9.2.6 - POSTGIS 2.1.2).
My application only ever reads from a slave, and I have a couple of 
questions with regards to indexes and vacuuming.
It is my understanding (probably incorrect) that any vacuuming executed 
on the master gets propagated to the slaves as part of the streaming 
replication process.

My main question is if I run a spatial query against a slave the first 
time, it may take 3 seconds, then the 2nd time it is near instant (if I 
query the same slave), so I'm assuming that the slave index/stats must 
be being updated? Vacuum is set to run once per night on the master, so 
does this mean that if I ran the query on that slave the next morning, 
it would take 3 seconds again?

On a similar point, I have a background process that creates dynamic 
spatial queries that I hope will help build up the GIST index, and 
increase the speed of users spatial queries, but I don't know whether to 
run these queries against the master or on each of the slaves?

Best regards,

Graham



More information about the postgis-users mailing list