How a single PostgreSQL config change improved slow query performance by 50x
21–30 of 46 posts
Re: How a single PostgreSQL config change improved slow query performance by 50x
#22For those interested in postgresql.conf tuning, I did a recent presentation at two conferences recently, hope it's interesting. Slides: https://speakerdeck.com/ongres/postgresql-configuration-for-... [shamless plug]
Re: How a single PostgreSQL config change improved slow query performance by 50x
#23Re: How a single PostgreSQL config change improved slow query performance by 50x
#24Why aren't these tuned automatically? Should be pretty easy.
Re: How a single PostgreSQL config change improved slow query performance by 50x
#25I always increase the seq scan cost, but another thing that helped me more was updating the table statistics. In that way you can make the planner better aware of your indexes. In my case I increased STATISTICS to 5000 and the planner immediately start using the index instead of full table scan. https://blog.pgaddict.com/posts/common-issues-with-planner-s...
Re: How a single PostgreSQL config change improved slow query performance by 50x
#26The prescription of changing sequential_page_cost to equal random_page_cost is certainly reasonable for SSD, but I wonder if the underlying issues aren't somewhat deeper and more interesting. One difference between a sequential scan and an index scan is the amount of data being scanned. PostgreSQL stores information horizontally as rows and a sequential scan will have to read in all column values of all rows. An inde…
Re: How a single PostgreSQL config change improved slow query performance by 50x
#27If I understand it correctly, PostgreSQL was using the default configuration. Which is rather inefficient, and is more about "must start everywhere".
Decreasing random_page_cost makes sense if you have storage that can handle random I/O well (although I wouldn't go to 1 even if it's an SSD). But who knows if the data was read from storage at all? Maybe it'd fit into RAM (and just increasing effective_cache_size would be enough for the planner to realize that).
Re: How a single PostgreSQL config change improved slow query performance by 50x
#28Unfortunately the author does not say some pretty basic things - which PostgreSQL version, how much data, how much of it fits into RAM, what storage (and hardware in general) ... If I understand it correctly, PostgreSQL was using the default configuration. Which is rather inefficient, and is more about "must start everywhere". Decreasing random_page_cost makes sense if you have storage that can handle random I/O well…
Re: How a single PostgreSQL config change improved slow query performance by 50x
#29The prescription of changing sequential_page_cost to equal random_page_cost is certainly reasonable for SSD, but I wonder if the underlying issues aren't somewhat deeper and more interesting. One difference between a sequential scan and an index scan is the amount of data being scanned. PostgreSQL stores information horizontally as rows and a sequential scan will have to read in all column values of all rows. An inde…
Re: How a single PostgreSQL config change improved slow query performance by 50x
#30Thanks for the tip. This probably affects more people than there are people who realize it. It would be really interesting if PG would use machine learning to discover this sort of tuning on its own.