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

From buhhunyx@tut.by
Subject Re: [BUGS] BUG #14750: Seq Scan instead of Index Scan works without limitation
Date
Msg-id 714641500536440@web1m.yandex.ru
Whole thread Raw
In response to Re: [BUGS] BUG #14750: Seq Scan instead of Index Scan works without limitation  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] BUG #14750: Seq Scan instead of Index Scan works without limitation
List pgsql-bugs
Seq Scan is fine except its ignore PRIMARY KEY and UNIQUE CONSTRAINT: in case result is found it should be immediatly
returnedto avoid scan rest of data:
 

# explain analyze select accountid from accounts where accountname = 'accountId50';Seq Scan on accounts
(cost=0.00..2.50rows=1 width=12) (actual time=0.018..0.029 rows=1 loops=1)  Filter: ((accountname)::text =
'accountId50'::text) Rows Removed by Filter: 119Planning time: 0.075 msExecution time: 0.048 ms
 

In product no 'LIMIT 1' specified because first found result expected; in case of huge amout simple queries difference
isvaluable:
 

# explain analyze select accountid from accounts where accountname = 'accountId50' limit 1;Limit  (cost=0.00..2.50
rows=1width=12) (actual time=0.016..0.016 rows=1 loops=1)  ->  Seq Scan on accounts  (cost=0.00..2.50 rows=1 width=12)
(actualtime=0.014..0.014 rows=1 loops=1)        Filter: ((accountname)::text = 'accountId50'::text)        Rows Removed
byFilter: 50Planning time: 0.084 msExecution time: 0.035 ms
 


-- 
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: Chris Pacejo
Date:
Subject: Re: [BUGS] BUG #14691: Isolation failure in deferrable transactionconcurrent with schema change
Next
From: zuberre@gmail.com
Date:
Subject: [BUGS] BUG #14754: ecpg SQL parsing error