I have a local PG instance populated with 10's of millions of rows of data and need to run some relatively complex queries for some data analysis work.
These queries are currently taking 10+ minutes to return (even after adding custom index's for every query I'm running).
While this may not be the "right tool for the job", I'm sure that my system isn't fully utilizing its available resources. I've configured my system using PGTune, but it still seems like this is taking into account a margin of safety for application stability, multiple connections, competing processes, etc.
If I just want PG to run as fast as it possibly can for my single connection...
What are the most important settings? And how should they be configured, relative to the system specs?
(Mine are 8-core, 32GB ram for example)
EXPLAINfirst for a reason - even a very slight improvement to your schema and the queries in your pipeline can yield disproportionately better results (orders of magnitude) than multiplying your resources, lifting all resource consumption constraints and removing all safety measures. One advantage of those last 3 things is you don't have to read any of the code you're trying to speed up - which might be preferable when dealing with a ton of legacy code to go through. Still, even then, removing just a few most obvious bottlenecks might outweigh all config tweaks.explain(analyze, verbose, buffers, settings)for your slow SQL statement, the statement itself and the DDL for all tables and indexes involved? All in plain text, as an update of your question. And for your information, there is no configuration setting "maximize compute resources for a single connection". The best config depends on your hardware, usage pattern and configuration.