From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jan Walter <john@commontongue.com>
Cc: postgres performance list <pgsql-performance@postgresql.org>
Subject: Re: Size of IN list affects query plan
Date: Fri, 08 Nov 2013 09:31:42 -0500
Message-ID: <27470.1383921102@sss.pgh.pa.us> (raw)
In-Reply-To: <527CEF87.6080008@commontongue.com>
References: <527CEF87.6080008@commontongue.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
Jan Walter <john@commontongue.com> writes:
> I would like to know, how does the size of the IN list affect query planner.
AFAICT, the reason the second plan is slow is the large number of checks
of the IN list. The planner does account for the cost of that, but it's
drastically underestimating that cost relative to the cost of I/O for the
heap and index accesses. I suppose that your test case is fully cached in
memory, which helps make the CPU costs more important than I/O costs.
If you think this is representative of your real workload, then you
need to decrease random_page_cost (and maybe seq_page_cost too) to make
the cost estimates correspond better to that reality.
regards, tom lane
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, john@commontongue.com
Subject: Re: Size of IN list affects query plan
In-Reply-To: <27470.1383921102@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