Thread: analyze at startup?
Analyze command helps increase performance.
Suppose i have n connections to the database..and each connection i query. So does this mean that i need to do an analyse over each of those connections.
Cant analyze be done one time...
and also please tell if there is any way in postgresql to tell it to perform analyze periodically after some time gap.
Thank You
Surabhi
Surabhi Ahuja wrote: > Analyze command helps increase performance. More exactly, it updates statistics so the planner knows that (e.g.) you have lots of different values in the invoice_date column. > Suppose i have n connections to the database..and each connection i > query. So does this mean that i need to do an analyse over each of > those connections. No. You only need to analyse if your data changes greatly. > Cant analyze be done one time... and also please tell if there is any > way in postgresql to tell it to perform analyze periodically after > some time gap. Haven't used the autovacuum add-on myself, but probably worth looking at it. -- Richard Huxton Archonet Ltd
See here for more details: http://www.postgresql.org/docs/8.0/static/maintenance.html In short, you don't need to do a vacuum analyze for each connection--it is a database-specific or table-specific task, not a connection-specific one. You can use vacuum analyze when you think things have changed enough in one or all tables to justify its use. What justifies enough change is a bit of an open question, although I think a rough number is if a table changes by about 15%, it then needs a vacuum analyze. In practice, you can just use cron (see man cron on a unix-like system) to set up a vacuum for nightly, weekly, or something like that. Sean On May 19, 2005, at 6:20 AM, Surabhi Ahuja wrote: > Analyze command helps increase performance. > Suppose i have n connections to the database..and each connection i > query. So does this mean that i need to do an analyse over each of > those connections. > > Cant analyze be done one time... > and also please tell if there is any way in postgresql to tell it to > perform analyze periodically after some time gap. > > Thank You > Surabhi