I'm pretty happy with the outcome of today. We had some great success at work getting some performance issues worked out with a pesky, large dataset. We did some EXPLAIN ANALYZE analysis on a few queries, and determined where indexes needed to be installed.
After installing an index we were sure would clear up performance issues - we reloaded the page and viola! - it worked. We re-ran EXPLAIN ANALYZE only to find out.. hang on.. a different index was being used. What's even weirder is - the index that was being used was different from the index that was being used yesterday when we checked, even though it already existed.
But wait, we didn't run ANALYZE <table_name>;... how did the query planner just.. sort this out? Turns out there's this fancy thing called the AUTOVACUUM Daemon. The AUTOVACUUM daemon is enabled in the default configuration, and what it does is it automatically vacuums the database so that you don't have to manually run the VACUUM statement. So, the table was clearly vacuumed in between our two EXPLAIN ANALYZE runs. Pretty neat!
Re-running ANALYZE <table_name>; did end up causing the query planner to find our new index much more valuable, but this was still a neat find for me, as I don't typically do much Postgres work.
I'm pretty excited for tomorrow. I've got a Kodak PIXPRO FZ55-BK being shipped to the house sometime hopefully in the morning. If it gets here early enough, I'll have it to take pictures of our time at the fall festival we're going to that afternoon. We go every year, and normally I take our Sony A600, which is an obviously better camera, I just want something a little more compact for tomorrow.
No comments:
Post a Comment