pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Glaesemann <grzm@seespotcode.net>
To: Richard Ray <rray@mstc.state.ms.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to influence the planner
Date: Fri, 31 Aug 2007 14:18:36 -0500
Message-ID: <373D2F52-E9CD-485A-9BF1-B019349FA5EC@seespotcode.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0708311116000.17749@rray.drdc.mstc.ms.gov>
References: <Pine.LNX.4.64.0708311116000.17749@rray.drdc.mstc.ms.gov>


On Aug 31, 2007, at 13:32 , Richard Ray wrote:

> "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


EXPLAIN ANALYZE will help you see what the planner is doing to  
produce the results. Have you recently ANALYZEd t1? If length(bar) =  
0 is a common operation on this table, you might consider using an  
expression index on t1:

create index t1_length_bar_idx on t1 (length(bar));

You might want to ask on the performance list as well, as this is  
right up their alley.

Hope this gets you started on the right track.

Michael Glaesemann
grzm seespotcode net





view thread (10+ messages)  latest in thread

Message-ID: <373D2F52-E9CD-485A-9BF1-B019349FA5EC@seespotcode.net>
Permalink:  ../373D2F52-E9CD-485A-9BF1-B019349FA5EC@seespotcode.net/
Also on:    postgresql.org/message-id/373D2F52-E9CD-485A-9BF1-B019349FA5EC@seespotcode.net

 · 

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: grzm@seespotcode.net, rray@mstc.state.ms.us
  Subject: Re: How to influence the planner
  In-Reply-To: <373D2F52-E9CD-485A-9BF1-B019349FA5EC@seespotcode.net>

* 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