| From: | Martin Weinberg <weinberg(at)osprey(dot)phast(dot)umass(dot)edu> |
|---|---|
| To: | pgsql-general(at)postgreSQL(dot)org |
| Cc: | weinberg(at)osprey(dot)phast(dot)umass(dot)edu |
| Subject: | Problems with inequalities on numeric fields in 6.5 |
| Date: | 1999-07-07 02:48:20 |
| Message-ID: | 199907070248.WAA18028@osprey.phast.umass.edu |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Folks,
I have som large data basees (from 7 million to 20 million
records and growing) and want to optimize selection in a
range between two float4 values. I have made indices on the
relevant variables.
I notice that a query such as:
select count(*) from mydata where x='3.4';
executes in under 10 seconds. However, a query such as
select count(*) from mydata where x>'3.4' and x<'3.5';
takes at least 20 minutes. EXPLAIN suggests that both
are using an index scan.
Not forcing float4 conversion does much better, e.g.
select count(*) from mydata where x>3.4 and x<3.5;
returns in under a minute although EXPLAIN suggests
that an sequential scan is used.
Can anyone give me some guidance on what that best
strategy is do select records in a range of float4
values?
Thanks!
--Martin
P.S. This behavior is also present in 6.4.2.
===========================================================================
Martin Weinberg Phone: (413) 545-3821
Dept. of Physics and Astronomy FAX: (413) 545-2117/0648
530 Graduate Research Tower
University of Massachusetts
Amherst, MA 01003-4525
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Martin Weinberg | 1999-07-07 02:49:36 | Re: [GENERAL] Problems with inequalities on numeric fields in 6.5 |
| Previous Message | Bruce Momjian | 1999-07-07 02:17:50 | Re: [HACKERS] RE: [GENERAL] Transaction logging |