Re: [GENERAL] Problems with inequalities on numeric fields in 6.5

From: Martin Weinberg <weinberg(at)osprey(dot)phast(dot)umass(dot)edu>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Martin Weinberg <weinberg(at)osprey(dot)phast(dot)umass(dot)edu>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Problems with inequalities on numeric fields in 6.5
Date: 1999-07-07 12:21:06
Message-ID: 199907071321.JAA19902@osprey.phast.umass.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruce Momjian wrote on Wed, 07 Jul 1999 04:07:00 EDT
>> lmc=> explain select count(*) from lmctot where j_m>'3.4' and j_m<'3.5';
>> NOTICE: QUERY PLAN:
>>
>> Aggregate (cost=62349.97 rows=788100 width=4)
>> -> Index Scan using j on lmctot (cost=62349.97 rows=788100 width=4)
>>
>>
>Please try this:
>
> lmc=> explain select count(*) from lmctot where j_m>3.4::float4 and
> j_m<3.5::float4
>
>Also, given your min/max, I am not sure why it thinks it is going to get
>788,100 rows. How many rows in the table again?
>
>Does (3.5-3.4)/(max-min) * #rows = 788k?
>

Thanks, Bruce!

Yes, I tried the latter query and it's the same:

--------------------------------------------------

lmc=> explain select count(*) from lmctot where j_m>3.4::float4 and j_m<3.5::float4;
NOTICE: QUERY PLAN:

Aggregate (cost=62349.97 rows=788100 width=4)
-> Index Scan using j on lmctot (cost=62349.97 rows=788100 width=4)

EXPLAIN

--------------------------------------------------
I've tried all permutations of the conversions in the ranges with
similar results (and vacuum analyzed several times as well as
dumped and reloaded and reloaded from scracth). We have
a larger database with 20M rows which has a similar behavior.

There are 7092894 rows in database "lmc". So:

(3.5-3.4)/(99.999-2.731) = 7292.1 != 788k

A clue?

Thanks again,

--M

===========================================================================

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff MacDonald 1999-07-07 13:01:53 Re: [GENERAL] How to compile PosttgreSQL on NT
Previous Message Vadim Mikheev 1999-07-07 11:00:03 Re: [HACKERS] RE: [GENERAL] Transaction logging