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