pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: buhhunyx@tut.by
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14750: Seq Scan instead of Index Scan works without limitation
Date: Wed, 19 Jul 2017 10:21:20 -0400
Message-ID: <7335.1500474080@sss.pgh.pa.us> (raw)
In-Reply-To: <20170719114246.19352.23577@wrigleys.postgresql.org>
References: <20170719114246.19352.23577@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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



view thread (4+ messages)  latest in thread

Message-ID: <7335.1500474080@sss.pgh.pa.us>
Permalink:  ../7335.1500474080@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7335.1500474080@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, buhhunyx@tut.by
  Subject: Re: BUG #14750: Seq Scan instead of Index Scan works without limitation
  In-Reply-To: <7335.1500474080@sss.pgh.pa.us>
  References: <20170719114246.19352.23577@wrigleys.postgresql.org> <7335.1500474080@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox