Описание тега postgresql-performance
In PostgreSQL there are typically many different queries to achieve the same output from a given input. If you already know a way to get your output but need a faster solution then this tag may be appropriate. Tag with postgresql as well.
Questions about overall PostgreSQL server performance tuning or the performance of queries you cannot change are probably better directed to https://dba.stackexchange.com/. See the stackru Help about suitable questions.
Read the Slow Query Questions page on the PostgreSQL Wiki before posting, including the "Things to try before you post" section. Using EXPLAIN ANALYZE
is particularly important.
When posting questions, include:
Your PostgreSQL version from
SELECT version()
, or at least your major version like12
or9.6
.The full query text, in readable format and as brief as possible. But don't remove anything that might be relevant. Describe the expected result, include an example.
Definition(s) of involved objects. Best as
CREATE ...
scripts. Or the output from\d+ tablename
(for tables) inpsql
.Cardinalities (rough number of rows) in involved tables.
Query plan(s) obtained with
EXPLAIN (BUFFERS, ANALYZE)
. If possible, paste on https://explain.depesz.com/ and include link(s).If possible, link to a short demo on https://dbfiddle.uk/, SQL Fiddle or similar.
Only if relevant, a brief mention of your hardware and system, like:
"CentOS 6.1, Xeon E5-2450 with 64GB RAM, 4-disk RAID 10 of Intel X-25E SSDs on Dell PERC H810 controller with flash write-back cache"