pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim Nasby <jimn@enterprisedb.com>
To: Ben <bench@silentmedia.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: any hope for my big query?
Date: Thu, 5 Oct 2006 23:02:57 -0500
Message-ID: <AB73891F-7475-4ADE-9D90-04E7CC1545EF@enterprisedb.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0610041423340.21293@GRD.cube42.tai.silentmedia.com>
References: <Pine.LNX.4.64.0609281505360.21293@GRD.cube42.tai.silentmedia.com>
	<20060929153557.GD90915@nasby.net>
	<Pine.LNX.4.64.0610041423340.21293@GRD.cube42.tai.silentmedia.com>

On Oct 4, 2006, at 4:40 PM, Ben wrote:
> I'm surprised (though probably just because I'm ignorant) that it  
> would have so much sequential scanning in there. For instance,  
> because n is going to have at most a couple dozen rows, it seems  
> that instead of scanning all of public.track, it should be able to  
> convert my "t.length between a and b" clause to some between  
> statements or'd together. Or at least, it would be nice if the  
> planner could do that.

That would require the planner having that knowledge at plan-time,  
which it can't without actually querying the database. One thing that  
might work wonders is performing the n query ahead of time and then  
sticking it in an array... that might speed things up.

Worst case, you could run the n query, and then run the rest of the  
query for each row of n you get back.

Better yet... send us a patch that allows the planner to look into  
what a subselect will return to us. ;)
--
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)


--
Jim Nasby                                    jimn@enterprisedb.com
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)





view thread (8+ messages)

Message-ID: <AB73891F-7475-4ADE-9D90-04E7CC1545EF@enterprisedb.com>
Permalink:  ../AB73891F-7475-4ADE-9D90-04E7CC1545EF@enterprisedb.com/
Also on:    postgresql.org/message-id/AB73891F-7475-4ADE-9D90-04E7CC1545EF@enterprisedb.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: jimn@enterprisedb.com, bench@silentmedia.com
  Subject: Re: any hope for my big query?
  In-Reply-To: <AB73891F-7475-4ADE-9D90-04E7CC1545EF@enterprisedb.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