Re: [BUGS] BUG #14750: Seq Scan instead of Index Scan works without limitation - Mailing list pgsql-bugs

From Tom Lane
Subject Re: [BUGS] BUG #14750: Seq Scan instead of Index Scan works without limitation
Date
Msg-id 7335.1500474080@sss.pgh.pa.us
Whole thread Raw
In response to [BUGS] BUG #14750: Seq Scan instead of Index Scan works without limitation  (buhhunyx@tut.by)
Responses Re: [BUGS] BUG #14750: Seq Scan instead of Index Scan works without limitation  (buhhunyx@tut.by)
List pgsql-bugs
buhhunyx@tut.by writes:
> 1) Create initial structure [1].

> 2) explain analyze SELECT * FROM accounts WHERE accountid = 'accountId50';

>  Index Scan using accounts_pkey on accounts  (cost=0.15..8.17 rows=1
> width=272) (actual time=0.022..0.022 rows=1 loops=1)
>    Index Cond: ((accountid)::text = 'accountId50'::text)
>  Planning time: 0.201 ms
>  Execution time: 0.045 ms

> 3) reindex table ACCOUNTS;

> 4) explain analyze SELECT * FROM accounts WHERE accountid = 'accountId50';

>  Seq Scan on accounts  (cost=0.00..2.50 rows=1 width=142) (actual
> time=0.024..0.037 rows=1 loops=1)
>    Filter: ((accountid)::text = 'accountId50'::text)
>    Rows Removed by Filter: 119
>  Planning time: 0.095 ms
>  Execution time: 0.060 ms

I see no bug here.  The REINDEX caused the system's stats about the table
size to get updated, so the planner now realizes that the table is not
large enough to be worth bothering with an indexscan.
        regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: johncarlo.butil@gmail.com
Date:
Subject: [BUGS] BUG #14752: Cannot re-install Postgres after uninstall
Next
From: dilaz03@gmail.com
Date:
Subject: [BUGS] BUG #14753: Bad selectivity estimation with functional partial index