pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mathias Kunter <mathiaskunter@gmail.com>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14107: Major query planner bug regarding subqueries and indices
Date: Wed, 11 May 2016 16:41:24 +0200
Message-ID: <cf9b0435-1ddf-fd58-e899-ddfd7d518c9e@gmail.com> (raw)
In-Reply-To: <CAKJS1f_798-+aewz9GS=OSYqk2mxQTuT7_9pWedSJbDoRzZnVg@mail.gmail.com>
References: <20160421115638.22895.78902@wrigleys.postgresql.org>
	<CAKJS1f_Hv+gBpg8JF0T8PEyW0TzVgydkcp2dPZHeomkDUGsRyA@mail.gmail.com>
	<69e376c7-6c2c-c96d-2ad6-3734affb59b7@gmail.com>
	<CAGnEboiCo+NuGab0PEnUQ2Nf0DXZv2Rvo2xWhMbi88n=guZB5w@mail.gmail.com>
	<CA+bJJbyUF6CZPgH45JUdRRJ96qHMd31Fb-qHw0iN2aohRYMM6g@mail.gmail.com>
	<CAGnEbogfdNPxN7vvY_8b4bPj4VVDzEw5NaXVBRSWUMQgKZE-CA@mail.gmail.com>
	<44df2e58-87f5-282c-9871-c735240c55e4@gmail.com>
	<1461406942121-5900147.post@n5.nabble.com>
	<3ac6f379-08f8-d1db-639f-2dc3075d2eb4@gmail.com>
	<1461610493986-5900430.post@n5.nabble.com>
	<629ecf23-b7b2-2d73-6792-150b111e83ab@gmail.com>
	<18635.1461892238@sss.pgh.pa.us>
	<fad91c29-5250-f856-2347-61122d4901ab@gmail.com>
	<CAKJS1f_798-+aewz9GS=OSYqk2mxQTuT7_9pWedSJbDoRzZnVg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

> How do you find the ANY(ARRAY(...)) version performs with say 10
> million records in the array?

I've tested with a subquery which returns about 20 million different 
rows. In this case IN(...) is about 5 times faster than ANY(ARRAY(...)) 
for me. The exact numbers are:

IN(...):           about 22 seconds
ANY(ARRAY(...)):   about 115 seconds

However, estimated query costs seem to be always correct. So shouldn't 
it be quite easy for the planner to create query plans for both the 
ANY(ARRAY(...)) and the IN(...) version and then just use the plan where 
costs are cheaper?


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (20+ messages)

Message-ID: <cf9b0435-1ddf-fd58-e899-ddfd7d518c9e@gmail.com>
Permalink:  ../cf9b0435-1ddf-fd58-e899-ddfd7d518c9e@gmail.com/
Also on:    postgresql.org/message-id/cf9b0435-1ddf-fd58-e899-ddfd7d518c9e@gmail.com

 · 

reply

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: mathiaskunter@gmail.com, david.rowley@2ndquadrant.com, tgl@sss.pgh.pa.us
  Subject: Re: BUG #14107: Major query planner bug regarding subqueries and indices
  In-Reply-To: <cf9b0435-1ddf-fd58-e899-ddfd7d518c9e@gmail.com>
  References: <20160421115638.22895.78902@wrigleys.postgresql.org> <CAKJS1f_Hv+gBpg8JF0T8PEyW0TzVgydkcp2dPZHeomkDUGsRyA@mail.gmail.com> <69e376c7-6c2c-c96d-2ad6-3734affb59b7@gmail.com> <CAGnEboiCo+NuGab0PEnUQ2Nf0DXZv2Rvo2xWhMbi88n=guZB5w@mail.gmail.com> <CA+bJJbyUF6CZPgH45JUdRRJ96qHMd31Fb-qHw0iN2aohRYMM6g@mail.gmail.com> <CAGnEbogfdNPxN7vvY_8b4bPj4VVDzEw5NaXVBRSWUMQgKZE-CA@mail.gmail.com> <44df2e58-87f5-282c-9871-c735240c55e4@gmail.com> <1461406942121-5900147.post@n5.nabble.com> <3ac6f379-08f8-d1db-639f-2dc3075d2eb4@gmail.com> <1461610493986-5900430.post@n5.nabble.com> <629ecf23-b7b2-2d73-6792-150b111e83ab@gmail.com> <18635.1461892238@sss.pgh.pa.us> <fad91c29-5250-f856-2347-61122d4901ab@gmail.com> <CAKJS1f_798-+aewz9GS=OSYqk2mxQTuT7_9pWedSJbDoRzZnVg@mail.gmail.com> <cf9b0435-1ddf-fd58-e899-ddfd7d518c9e@gmail.com>

* 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