From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ron <ronljohnsonjr@gmail.com>
Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: Do table-level CHECK constraints affect the query optimizer?
Date: Tue, 29 Jun 2021 12:42:56 -0400
Message-ID: <449566.1624984976@sss.pgh.pa.us> (raw)
In-Reply-To: <374d530d-ec98-f1ea-8d41-21e661aa9ab4@gmail.com>
References: <5f718120-a286-71ca-3d31-7bad70f0194e@gmail.com>
<CAHOFxGpN2_Jfe9Ah1WqLgEGMtOkjqzDp+bb_SVm2O28rojZJQA@mail.gmail.com>
<374d530d-ec98-f1ea-8d41-21e661aa9ab4@gmail.com>
Ron <ronljohnsonjr@gmail.com> writes:
> On 6/29/21 10:41 AM, Michael Lewis wrote:
>> What's an example query that uses indexes on test and does not on live?
> SELECT COUNT(*) FROM sep_info_report_extract;
> On prod, there's a list of "Parallel Seq Scan on xxxx_partname" records in
> the EXPLAIN output, while the test system has a list of "Parallel Index Only
> Scan using ..._idx" records.
It'd be worth checking pg_class.relallvisible page counts for the
partitions on both systems. If an IOS is possible, the main thing
that might push the planner to do a seqscan instead is if it thinks
that too little of the table is all-visible, which would tend to
inflate the index-only scan towards the same cost as a regular index
scan (which'll almost always be considered slower than seqscan).
If there's a significant difference in relallvisible fractions, that
would point to something different in your VACUUM housekeeping on
the two systems.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, ronljohnsonjr@gmail.com
Subject: Re: Do table-level CHECK constraints affect the query optimizer?
In-Reply-To: <449566.1624984976@sss.pgh.pa.us>
References: <5f718120-a286-71ca-3d31-7bad70f0194e@gmail.com> <CAHOFxGpN2_Jfe9Ah1WqLgEGMtOkjqzDp+bb_SVm2O28rojZJQA@mail.gmail.com> <374d530d-ec98-f1ea-8d41-21e661aa9ab4@gmail.com> <449566.1624984976@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox