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@sigaev.ru
WWW: http://www.sigaev.ru/