Re: Help w/speeding up range queries? - Mailing list pgsql-performance

From Marcin Mank
Subject Re: Help w/speeding up range queries?
Date
Msg-id 05e401c6fe6d$56d13780$0c67a8c0@maniek
Whole thread Raw
In response to Help w/speeding up range queries?  (John Major <major@cbio.mskcc.org>)
List 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


pgsql-performance by date:

Previous
From: "Simon Riggs"
Date:
Subject: Re: Database-wide vacuum can take a long time, duringwhich tables are not being analyzed
Next
From: "Simon Riggs"
Date:
Subject: Re: Help w/speeding up range queries?