Re: index scan leads to result that is different from sec scan after upgrading to 8.3.4 - Mailing list pgsql-general

From Sergey Konoplev
Subject Re: index scan leads to result that is different from sec scan after upgrading to 8.3.4
Date
Msg-id c3a7de1f0810210713j7c0f32c2ke195eab79f353848@mail.gmail.com
Whole thread Raw
In response to Re: index scan leads to result that is different from sec scan after upgrading to 8.3.4  ("Sergey Konoplev" <gray.ru@gmail.com>)
Responses Re: index scan leads to result that is different from sec scan after upgrading to 8.3.4  (Teodor Sigaev <teodor@sigaev.ru>)
Re: index scan leads to result that is different from sec scan after upgrading to 8.3.4  (Teodor Sigaev <teodor@sigaev.ru>)
List pgsql-general
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/

Attachment

pgsql-general by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [HACKERS] Hot Standby utility and administrator functions
Next
From: Craig Ringer
Date:
Subject: Re: Where are updates from inside transactions visible?