Re: BUG #14107: Major query planner bug regarding subqueries and indices

From: Mathias Kunter <mathiaskunter(at)gmail(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14107: Major query planner bug regarding subqueries and indices
Date: 2016-05-11 14:41:24
Message-ID: cf9b0435-1ddf-fd58-e899-ddfd7d518c9e@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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?

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message yjh0502 2016-05-11 15:49:04 BUG #14134: segmentation fault with large table with gist index
Previous Message Tom Lane 2016-05-11 14:33:25 Re: BUG #14132: ON CONFLICT not inferring unique index with bigints