pg.ddx.io pgsql-admin@postgresql.org mailing list archivehelp / color / mirror / Atom feed
problem concerning vacuum/statistics & query performance 3+ messages / 2 participants [nested] [flat]
* problem concerning vacuum/statistics & query performance @ 2002-01-18 15:35 Esger Abbink <pgadmin@bumblebeast.com> 0 siblings, 1 reply; 3+ messages in thread From: Esger Abbink @ 2002-01-18 15:35 UTC (permalink / raw) To: pgsql-admin Hi, i have a performance problem with a db. This db consists of only a few tables and is continuously fed with new datasets (3min interval) and at night it is pruned (all but the last set are deleted) and vacuumed. the problem is that queries run (far) too slow because the planner seems to be using incorrect statistics (during the day the larger tables will grow to several hundred-thousand rows). if i manually VACUUM ANALYZE the db when it is pretty loaded (~300k rows) the planner starts using a different plan which runs acceptable performance wise. however after the daily cleanup it reverts back to the old (bad) plan. so it seems the nightly VACUUM does some analyzing as well? in which case the planner is using totally off-base statistics for most of the day, which in itself isnt bad but i'd rather have it use large table stats on small tables than vice versa. any thoughts? (other than upgrading to 7.2 ;) ) (postgres is 7.0.3 btw) Esger -- NeoMail - Webmail that doesn't suck... as much. http://neomail.sourceforge.net ^ permalink raw reply [nested|flat] 3+ messages in thread
* problem concerning vacuum/statistics & query performance @ 2002-01-18 15:45 Esger Abbink <pgadmin@bumblebeast.com> 0 siblings, 0 replies; 3+ messages in thread From: Esger Abbink @ 2002-01-18 15:45 UTC (permalink / raw) To: pgsql-admin Hi, i have a performance problem with a db. This db consists of only a few tables and is continuously fed with new datasets (3min interval) and at night it is pruned (all but the last set are deleted) and vacuumed. the problem is that queries run (far) too slow because the planner seems to be using incorrect statistics (during the day the larger tables will grow to several hundred-thousand rows). if i manually VACUUM ANALYZE the db when it is pretty loaded (~300k rows) the planner starts using a different plan which runs acceptable performance wise. however after the daily cleanup it reverts back to the old (bad) plan. so it seems the nightly VACUUM does some analyzing as well? in which case the planner is using totally off-base statistics for most of the day, which in itself isnt bad but i'd rather have it use large table stats on small tables than vice versa. any thoughts? (other than upgrading to 7.2 ;) ) (postgres is 7.0.3 btw) Esger -- NeoMail - Webmail that doesn't suck... as much. http://neomail.sourceforge.net ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: problem concerning vacuum/statistics & query performance @ 2002-01-18 16:09 Tom Lane <tgl@sss.pgh.pa.us> parent: Esger Abbink <pgadmin@bumblebeast.com> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2002-01-18 16:09 UTC (permalink / raw) To: Esger Abbink <pgadmin@bumblebeast.com>; +Cc: pgsql-admin "Esger Abbink" <pgadmin@bumblebeast.com> writes: > if i manually VACUUM ANALYZE the db when it is pretty loaded (~300k > rows) the planner starts using a different plan which runs acceptable > performance wise. however after the daily cleanup it reverts back to > the old (bad) plan. > so it seems the nightly VACUUM does some analyzing as well? Plain VACUUM (no ANALYZE) won't touch pg_statistic, but it does update the pages and tuples estimates in pg_class. > in which case the planner is using totally off-base statistics for > most of the day, which in itself isnt bad but i'd rather have it use > large table stats on small tables than vice versa. You could do this in your nightly script: -- delete lotsa stuff from mytable; vacuum mytable; update pg_class set reltuples = M, relpages = N where relname = 'mytable'; where M and N correspond to the peak values instead of the minima. Kinda grotty but it'll get the job done. regards, tom lane ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-01-18 16:09 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2002-01-18 15:35 problem concerning vacuum/statistics & query performance Esger Abbink <pgadmin@bumblebeast.com> 2002-01-18 16:09 ` Tom Lane <tgl@sss.pgh.pa.us> 2002-01-18 15:45 problem concerning vacuum/statistics & query performance Esger Abbink <pgadmin@bumblebeast.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox