Created
August 24, 2010 18:26
-
-
Save gregglind/548041 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**************************** | |
* Unexpected result: | |
* analyzing this empty table doesn't update last_analzye in pg_stat_all_tables | |
*****************************/ | |
drop table if exists a; | |
create table a (exists int); | |
analyze a; | |
select relname,last_analyze from pg_stat_all_tables where relname = 'a'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You want last_autoanalyze for the last time the autovacuum daemon analyzed the table. It is odd that the 'analyze' value isn't updated when you do a manual ANALYZE (on a new, empty table) but a quick look at the code suggests that nothing is wrong, either. Consider filing a bug. Additionally, it only appears to happen in this one instance - namely, once the table has data in it, even if that data is later removed, 'ANALYZE' goes through all the motions - this I find odd, but not necessarily troubling.
See the autovacuum daemon settings for the various thresholds under which a table is automatically vacuumed and/or analyzed.