pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Ray <rray@mstc.state.ms.us>
To: pgsql-sql@postgresql.org
Subject: How to influence the planner
Date: Fri, 31 Aug 2007 13:32:17 -0500 (CDT)
Message-ID: <Pine.LNX.4.64.0708311116000.17749@rray.drdc.mstc.ms.gov> (raw)

I have a table, t1,  with about 12 million rows
The column foo is unique and indexed
The column bar is not unique and is indexed
"select * from t1 where length(bar) = 0;" runs about 2 minutes
"select * from t1 where length(bar) = 0 order by foo ;" ran until I
stopped it after about 20 minutes
My simple solution is "select * into t2 from t1 where length(bar) = 0;"
and "select * from t2 order by foo ;"
Is there a way to make "select * from t1 where length(bar) = 0 order by foo ;"
or something similar work

Thanks
Richard Ray




view thread (10+ messages)  latest in thread

Message-ID: <Pine.LNX.4.64.0708311116000.17749@rray.drdc.mstc.ms.gov>
Permalink:  ../Pine.LNX.4.64.0708311116000.17749@rray.drdc.mstc.ms.gov/
Also on:    postgresql.org/message-id/Pine.LNX.4.64.0708311116000.17749@rray.drdc.mstc.ms.gov

 · 

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-sql@postgresql.org
  Cc: rray@mstc.state.ms.us
  Subject: Re: How to influence the planner
  In-Reply-To: <Pine.LNX.4.64.0708311116000.17749@rray.drdc.mstc.ms.gov>

* 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