How to influence the planner

From: Richard Ray <rray(at)mstc(dot)state(dot)ms(dot)us>
To: pgsql-sql(at)postgresql(dot)org
Subject: How to influence the planner
Date: 2007-08-31 18:32:17
Message-ID: Pine.LNX.4.64.0708311116000.17749@rray.drdc.mstc.ms.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2007-08-31 19:18:36 Re: How to influence the planner
Previous Message Chris Browne 2007-08-31 17:49:10 Re: Incomprehensible dogged sort in Merge Join