Re: subselect requires offset 0 for good performance. - Mailing list pgsql-performance

From Scott Marlowe
Subject Re: subselect requires offset 0 for good performance.
Date
Msg-id CAOR=d=0S6NqnX=TfX1=81M442=LM6QaN1fy7FHowVCfVskipOg@mail.gmail.com
Whole thread Raw
In response to Re: subselect requires offset 0 for good performance.  (Vik Fearing <vik.fearing@dalibo.com>)
Responses Re: subselect requires offset 0 for good performance.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
OK I'm bumping this one last time in the hopes that someone has an
idea what to do to fix it.

Query plan: http://explain.depesz.com/s/kJ54

This query takes 180 seconds. It loops 17391 times across the lower
index using entries from the upper index. That seems buggy to me.
While the exact estimates are off, the fact that it estimates 10,433
rows in the above index scan means that it's expecting to do that many
loops on the bottom index scan.

This is one of those queries where adding an offset 0 to the inner
select reduces run time from 180s to 0.2s. And I can't imagine a plan
that thinks running 10k loops on an index scan is a good idea.


pgsql-performance by date:

Previous
From: Daniel Cristian Cruz
Date:
Subject: Index on a range array
Next
From: Tom Lane
Date:
Subject: Re: subselect requires offset 0 for good performance.