From: Tom Lane <tgl@sss.pgh.pa.us>
To: Soni M <diptatapa@gmail.com>
Cc: Postgres Bug <pgsql-bugs@postgresql.org>
Subject: Re: Scanning all partition when more than 100 items in "where id in ()" clause
Date: Thu, 26 Jul 2018 18:04:01 -0400
Message-ID: <19851.1532642641@sss.pgh.pa.us> (raw)
In-Reply-To: <CAAMgDXna_6gdaWKaj8Jc=oP6yAdM+HHktbRbJ28JXPNzbhrw2w@mail.gmail.com>
References: <CAAMgDXna_6gdaWKaj8Jc=oP6yAdM+HHktbRbJ28JXPNzbhrw2w@mail.gmail.com>
Soni M <diptatapa@gmail.com> writes:
> Hello All, I think I found bug here. Postgres 9.6.9 on Red Hat Enterprise
> Linux Server release 7.5 (Maipo).
I think it's a consequence of the limitation in predtest.c that it won't
try to do predicate proofs using ScalarArrayOps with more than 100 array
entries:
/*
* Proof attempts involving large arrays in ScalarArrayOpExpr nodes are
* likely to require O(N^2) time, and more often than not fail anyway.
* So we set an arbitrary limit on the number of array elements that
* we will allow to be treated as an AND or OR clause.
* XXX is it worth exposing this as a GUC knob?
*/
#define MAX_SAOP_ARRAY_SIZE 100
Not a bug, but a tradeoff. You'd be unhappy if the planner spent longer
devising the plan than it saved to eliminate the extra partitions.
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, diptatapa@gmail.com
Subject: Re: Scanning all partition when more than 100 items in "where id in ()" clause
In-Reply-To: <19851.1532642641@sss.pgh.pa.us>
References: <CAAMgDXna_6gdaWKaj8Jc=oP6yAdM+HHktbRbJ28JXPNzbhrw2w@mail.gmail.com> <19851.1532642641@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