From: | "Marcin Mank" <marcin(dot)mank(at)gmail(dot)com> |
---|---|
To: | "John Major" <major(at)cbio(dot)mskcc(dot)org>, <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Help w/speeding up range queries? |
Date: | 2006-11-02 10:54:57 |
Message-ID: | 05e401c6fe6d$56d13780$0c67a8c0@maniek |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
> Ie: select FeatureID from SIMPLE_TABLE where FeatureChromosomeName like
> 'chrX' and StartPosition > 1000500 and EndPosition < 2000000;
How about ( this assumes that StartPosition <= EndPosition ):
select FeatureID
from SIMPLE_TABLE
where FeatureChromosomeName llike 'chrX'
and StartPosition > 1000500
and StartPosition < 2000000
and EndPosition > 1000500
and EndPosition < 2000000;
This at least should help the planner with estimating number of rows.
Also think twice when You assume that a query with ILIKE will use an index.
Read about varchar_pattern_ops.
Make an index on (FeatureChromosomeName,StartPosition) , and all should be
fine.
Greetings
Marcin
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2006-11-02 10:59:47 | Re: Help w/speeding up range queries? |
Previous Message | Simon Riggs | 2006-11-02 10:49:18 | Re: Database-wide vacuum can take a long time, duringwhich tables are not being analyzed |