Skip to main content

update link
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620

If you already know a way to get your output but need a faster solution then this tag may be appropriate. May concern techniques for a particular query or the setup of your hard- and software. Tag with as well.

Questions how to optimize simple queries should rather go to stackoverflow.com. See the DBA Help for information about suitable questions.

Consider the basic advice on Performance Optimization and Slow Query Questions in PostgreSQL Wiki before asking questions on this tag, including the "Things to try before you post" section. Using EXPLAIN is particularly important.

###When posting questions, include:

  • Your Postgres version, from SELECT version(), or at least your major version like 9.6 or 10.

  • The full text of the query/queries. In a readable format and as brief as possible, but don't remove anything that might be relevant. Describe the expected result / include an example for simple cases.

  • Table definition(s): Preferably a CREATE TABLE script showing data types and constraints for relevant columns and CREATE INDEX scripts for all relevant indexes. Or the output from \d+ tablename in psqlpsql.

  • Cardinalities (rough number of rows) in involved tables. Rough distribution of critical values (if applicable).

  • Query plan(s) obtained with EXPLAIN (BUFFERS, ANALYZE) or EXPLAIN ANALYZE in pg 9.0 or older. If possible paste them on explain.depesz.com and include links.

  • If possible, add a link to an online demo at db<>fiddle, SQL Fiddle or similar, populated with the schema, some sample data, and the query.

  • Only where 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"
    Or more details if your question is about hardware.

If you already know a way to get your output but need a faster solution then this tag may be appropriate. May concern techniques for a particular query or the setup of your hard- and software. Tag with as well.

Questions how to optimize simple queries should rather go to stackoverflow.com. See the DBA Help for information about suitable questions.

Consider the basic advice on Performance Optimization and Slow Query Questions in PostgreSQL Wiki before asking questions on this tag, including the "Things to try before you post" section. Using EXPLAIN is particularly important.

###When posting questions, include:

  • Your Postgres version, from SELECT version(), or at least your major version like 9.6 or 10.

  • The full text of the query/queries. In a readable format and as brief as possible, but don't remove anything that might be relevant. Describe the expected result / include an example for simple cases.

  • Table definition(s): Preferably a CREATE TABLE script showing data types and constraints for relevant columns and CREATE INDEX scripts for all relevant indexes. Or the output from \d+ tablename in psql.

  • Cardinalities (rough number of rows) in involved tables. Rough distribution of critical values (if applicable).

  • Query plan(s) obtained with EXPLAIN (BUFFERS, ANALYZE) or EXPLAIN ANALYZE in pg 9.0 or older. If possible paste them on explain.depesz.com and include links.

  • If possible, add a link to an online demo at db<>fiddle, SQL Fiddle or similar, populated with the schema, some sample data, and the query.

  • Only where 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"
    Or more details if your question is about hardware.

If you already know a way to get your output but need a faster solution then this tag may be appropriate. May concern techniques for a particular query or the setup of your hard- and software. Tag with as well.

Questions how to optimize simple queries should rather go to stackoverflow.com. See the DBA Help for information about suitable questions.

Consider the basic advice on Performance Optimization and Slow Query Questions in PostgreSQL Wiki before asking questions on this tag, including the "Things to try before you post" section. Using EXPLAIN is particularly important.

###When posting questions, include:

  • Your Postgres version, from SELECT version(), or at least your major version like 9.6 or 10.

  • The full text of the query/queries. In a readable format and as brief as possible, but don't remove anything that might be relevant. Describe the expected result / include an example for simple cases.

  • Table definition(s): Preferably a CREATE TABLE script showing data types and constraints for relevant columns and CREATE INDEX scripts for all relevant indexes. Or the output from \d+ tablename in psql.

  • Cardinalities (rough number of rows) in involved tables. Rough distribution of critical values (if applicable).

  • Query plan(s) obtained with EXPLAIN (BUFFERS, ANALYZE) or EXPLAIN ANALYZE in pg 9.0 or older. If possible paste them on explain.depesz.com and include links.

  • If possible, add a link to an online demo at db<>fiddle, SQL Fiddle or similar, populated with the schema, some sample data, and the query.

  • Only where 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"
    Or more details if your question is about hardware.

update links, trim noise; deleted 47 characters in body
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620

If you already know a way to get your output but need a faster solution then this tag may be appropriate. May concern techniques for a particular query or the setup of your hard- and software. Tag with as well.

Questions how to optimize simple queries should rather go to stackoverflow.comstackoverflow.com. See the DBA Help for information about suitable questions.

Consider the basic advice on Performance Optimization and Slow Query Questions in PostgreSQL Wiki before asking questions on this tag, including the "Things to try before you post" section. Using EXPLAIN is particularly important. Useful ebooks are freely available.

###When posting questions, include:

  • Your Postgres version, from SELECT version(), or at least your major version like 9.6 or 10.

  • The full text of the query/queries. In a readable format and as brief as possible, but don't remove anything that might be relevant. Describe the expected result / include an example for simple cases.

  • Table definition(s): Preferably a CREATE TABLE script showing data types and constraints for relevant columns and CREATE INDEX scripts for all relevant indexes. Or the output from \d+ tablename in psqlpsql.

  • Cardinalities (rough number of rows) in involved tables. Rough distribution of critical values (if applicable).

  • Query plan(s) obtained with EXPLAIN (BUFFERS, ANALYZE) or EXPLAIN ANALYZE in pg 9.0 or older. If possible paste them on explain.depesz.comexplain.depesz.com and include links.

  • If possible, add a link to an online demo at dbfiddledb<>fiddle, SQL Fiddle or similar, populated with the schema, some sample data, and the query.

  • Only where 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"
    Or more details if your question is about hardware.

If you already know a way to get your output but need a faster solution then this tag may be appropriate. May concern techniques for a particular query or the setup of your hard- and software. Tag with as well.

Questions how to optimize simple queries should rather go to stackoverflow.com. See the DBA Help for information about suitable questions.

Consider the basic advice on Performance Optimization and Slow Query Questions in PostgreSQL Wiki before asking questions on this tag, including the "Things to try before you post" section. Using EXPLAIN is particularly important. Useful ebooks are freely available.

###When posting questions, include:

  • Your Postgres version, from SELECT version(), or at least your major version like 9.6 or 10.

  • The full text of the query/queries. In a readable format and as brief as possible, but don't remove anything that might be relevant. Describe the expected result / include an example for simple cases.

  • Table definition(s): Preferably a CREATE TABLE script showing data types and constraints for relevant columns and CREATE INDEX scripts for all relevant indexes. Or the output from \d+ tablename in psql.

  • Cardinalities (rough number of rows) in involved tables. Rough distribution of critical values (if applicable).

  • Query plan(s) obtained with EXPLAIN (BUFFERS, ANALYZE) or EXPLAIN ANALYZE in pg 9.0 or older. If possible paste them on explain.depesz.com and include links.

  • If possible, add a link to an online demo at dbfiddle, SQL Fiddle or similar, populated with the schema, some sample data, and the query.

  • Only where 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"
    Or more details if your question is about hardware.

If you already know a way to get your output but need a faster solution then this tag may be appropriate. May concern techniques for a particular query or the setup of your hard- and software. Tag with as well.

Questions how to optimize simple queries should rather go to stackoverflow.com. See the DBA Help for information about suitable questions.

Consider the basic advice on Performance Optimization and Slow Query Questions in PostgreSQL Wiki before asking questions on this tag, including the "Things to try before you post" section. Using EXPLAIN is particularly important.

###When posting questions, include:

  • Your Postgres version, from SELECT version(), or at least your major version like 9.6 or 10.

  • The full text of the query/queries. In a readable format and as brief as possible, but don't remove anything that might be relevant. Describe the expected result / include an example for simple cases.

  • Table definition(s): Preferably a CREATE TABLE script showing data types and constraints for relevant columns and CREATE INDEX scripts for all relevant indexes. Or the output from \d+ tablename in psql.

  • Cardinalities (rough number of rows) in involved tables. Rough distribution of critical values (if applicable).

  • Query plan(s) obtained with EXPLAIN (BUFFERS, ANALYZE) or EXPLAIN ANALYZE in pg 9.0 or older. If possible paste them on explain.depesz.com and include links.

  • If possible, add a link to an online demo at db<>fiddle, SQL Fiddle or similar, populated with the schema, some sample data, and the query.

  • Only where 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"
    Or more details if your question is about hardware.

clarify instructions
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620

If you already know a way to get your output but need a faster solution then this tag may be appropriate. May concern techniques for a particular query or the setup of your hard- and software. Tag with as well.

Questions how to optimize simple queries should rather go to stackoverflow.com. See the DBA Help for information about suitable questions.

Consider the basic advice on Performance Optimization and Slow Query Questions in PostgreSQL Wiki before asking questions on this tag, including the "Things to try before you post" section. Using EXPLAIN is particularly important. Useful ebooks are freely available.

###When posting questions, include:

  • Your PostgreSQL versionPostgres version, from SELECT version(), or at least your major version like 9.46 or 10.

  • The full text of the queryquery/queries. In a readable format and as brief as possible, but don't remove anything that might be relevant. Describe the expected result / include an example for simple cases.

  • DefinitionTable definition(s) of involved tables: Preferably a CREATE TABLE script showing data types and constraints for relevant columns and CREATE INDEX scripts orfor all relevant indexes. Or the output from \d+ tablename in psql.

  • CardinalitiesCardinalities (rough number of rows) in involved tables. Rough distribution of critical values (if applicable).

  • Query planQuery plan(s) obtained with EXPLAIN (BUFFERS, ANALYZE) or EXPLAIN ANALYZE in pg 9.0 or older. If possible paste them on explain.depesz.com and include links.

  • If possible, add a link to an online demo at dbfiddle, SQL Fiddle or similar, populated with the schema, some sample data, and the query.

  • Only where 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"
    Or more details if your question is about hardware.

If you already know a way to get your output but need a faster solution then this tag may be appropriate. May concern techniques for a particular query or the setup of your hard- and software. Tag with as well.

Questions how to optimize simple queries should rather go to stackoverflow.com. See the DBA Help for information about suitable questions.

Consider the basic advice on Performance Optimization and Slow Query Questions in PostgreSQL Wiki before asking questions on this tag, including the "Things to try before you post" section. Using EXPLAIN is particularly important. Useful ebooks are freely available.

###When posting questions, include:

  • Your PostgreSQL version, from SELECT version(), or at least your major version like 9.4.

  • The full text of the query/queries. In a readable format and as brief as possible, but don't remove anything that might be relevant. Describe the expected result / include an example for simple cases.

  • Definition(s) of involved tables: CREATE TABLE and CREATE INDEX scripts or the output from \d+ tablename in psql.

  • Cardinalities (rough number of rows) in involved tables.

  • Query plan(s) obtained with EXPLAIN (BUFFERS, ANALYZE) or EXPLAIN ANALYZE in pg 9.0 or older. If possible paste them on explain.depesz.com and include links.

  • If possible, add a link to an online demo at dbfiddle, SQL Fiddle or similar, populated with the schema, some sample data, and the query.

  • Only where 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"
    Or more details if your question is about hardware.

If you already know a way to get your output but need a faster solution then this tag may be appropriate. May concern techniques for a particular query or the setup of your hard- and software. Tag with as well.

Questions how to optimize simple queries should rather go to stackoverflow.com. See the DBA Help for information about suitable questions.

Consider the basic advice on Performance Optimization and Slow Query Questions in PostgreSQL Wiki before asking questions on this tag, including the "Things to try before you post" section. Using EXPLAIN is particularly important. Useful ebooks are freely available.

###When posting questions, include:

  • Your Postgres version, from SELECT version(), or at least your major version like 9.6 or 10.

  • The full text of the query/queries. In a readable format and as brief as possible, but don't remove anything that might be relevant. Describe the expected result / include an example for simple cases.

  • Table definition(s): Preferably a CREATE TABLE script showing data types and constraints for relevant columns and CREATE INDEX scripts for all relevant indexes. Or the output from \d+ tablename in psql.

  • Cardinalities (rough number of rows) in involved tables. Rough distribution of critical values (if applicable).

  • Query plan(s) obtained with EXPLAIN (BUFFERS, ANALYZE) or EXPLAIN ANALYZE in pg 9.0 or older. If possible paste them on explain.depesz.com and include links.

  • If possible, add a link to an online demo at dbfiddle, SQL Fiddle or similar, populated with the schema, some sample data, and the query.

  • Only where 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"
    Or more details if your question is about hardware.

add dbfiddle
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620
Loading
sharpen requirements
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620
Loading
hardware often not relevant to question
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620
Loading
typos, add link to Performance Optimization in Postgres Wiki
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620
Loading
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620
Loading