Problems with inequalities on numeric fields in 6.5

Поиск
Список
Период
Сортировка
От Martin Weinberg
Тема Problems with inequalities on numeric fields in 6.5
Дата
Msg-id 199907070248.WAA18028@osprey.phast.umass.edu
обсуждение исходный текст
Ответы Re: [GENERAL] Problems with inequalities on numeric fields in 6.5  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Juan Grigera
Дата:
Сообщение: JoinClauseSelecivity: bad value
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [GENERAL] How to compile PosttgreSQL on NT