Re: index scan leads to result that is different from sec scan after upgrading to 8.3.4

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: index scan leads to result that is different from sec scan after upgrading to 8.3.4
Date: 2008-10-21 16:35:54
Message-ID: 48FE04EA.8060600@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you, I reproduce the bug, will fix.

Sergey Konoplev wrote:
> Ok, I've done the test case (see attachment).
>
> 8.3.3 has passed it.
> 8.3.4 hasn't passed in ~99% times I run it.
>
> Steps to reproduce:
> 1. install pg 8.3.4, do initdb, start pg
> 2. correct PSQL parameter in pg-8.3.4_index_update_test.sh
> 3. run pg-8.3.4_index_update_test.sh few times
>
> And you will see something like this:
>
> ...
>
> ------------------------------------------
> 2nd time obtaining "seq-scan" count and plan...
> ------------------------------------------
> SELECT table1_flag, count(*) FROM table1
> GROUP BY table1_flag;
> table1_flag | count
> -------------+-------
> 1 | 100
> (1 row)
>
> EXPLAIN ANALYZE SELECT table1_flag, count(*) FROM table1
> GROUP BY table1_flag;
> QUERY PLAN
> -----------------------------------------------------------------------------------------------------------
> HashAggregate (cost=15.00..15.01 rows=1 width=2) (actual
> time=0.140..0.140 rows=1 loops=1)
> -> Seq Scan on table1 (cost=0.00..12.00 rows=600 width=2) (actual
> time=0.004..0.059 rows=100 loops=1)
> Total runtime: 0.172 ms
> (3 rows)
>
> ------------------------------------------
> 2nd time obtaining "index-scan" count and plan...
> ------------------------------------------
> SELECT count(*) FROM table1
> WHERE table1_flag = 1;
> count
> -------
> 98
> (1 row)
>
> EXPLAIN ANALYZE SELECT count(*) FROM table1
> WHERE table1_flag = 1;
> QUERY
> PLAN
> --------------------------------------------------------------------------------------------------------------------------------------
> Aggregate (cost=8.27..8.28 rows=1 width=0) (actual time=0.451..0.451
> rows=1 loops=1)
> -> Index Scan using i_table1__table1_point on table1
> (cost=0.00..8.27 rows=1 width=0) (actual time=0.011..0.408 rows=98
> loops=1)
> Total runtime: 0.477 ms
> (3 rows)
>
> --
> Regards,
> Sergey Konoplev
> --
> PostgreSQL articles in english & russian
> http://gray-hemp.blogspot.com/search/label/postgresql/

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2008-10-21 16:46:03 Re: How to free disk space
Previous Message Ivan Sergio Borgonovo 2008-10-21 16:06:25 Re: exposing more parse was: Re: tsearch2: setting weights on tsquery