Re: limit and query planner

2018-06-05 Thread David Rowley
On 6 June 2018 at 07:17, armand pirvu wrote: > So since > select count(*) from sp_i2birst_reg_staging_test; > count > --- > 6860 > and > select count(*) from sp_i2birst_reg_staging_test where evt_id = 'ACSF17' > and status=0 ; > count > --- > 4239 > > That means to me I fetch almost the

Re: limit and query planner

2018-06-05 Thread armand pirvu
> On Jun 5, 2018, at 2:02 PM, Tom Lane wrote: > > armand pirvu writes: >> My question is: I suspect the limit simply limits the fethching to the first >> n-records retrieved and has no implications whatsoever on the planner, >> meaning the planner ignores it. Am I right or wrong ? > > You'r

Re: limit and query planner

2018-06-05 Thread Tom Lane
armand pirvu writes: > My question is: I suspect the limit simply limits the fethching to the first > n-records retrieved and has no implications whatsoever on the planner, > meaning the planner ignores it. Am I right or wrong ? You're quite wrong. The presence of a LIMIT causes the planner to

Re: limit and query planner

2018-06-05 Thread armand pirvu
> On Jun 5, 2018, at 1:32 PM, Pavel Stehule wrote: > > > > 2018-06-05 20:24 GMT+02:00 armand pirvu >: > All > > Please see below > > explain analyze select * from sp_i2birst_reg_staging_test where evt_id = > 'ACSF17' > and status=0 limit 10; >

Re: limit and query planner

2018-06-05 Thread Pavel Stehule
2018-06-05 20:24 GMT+02:00 armand pirvu : > All > > Please see below > > explain analyze select * from sp_i2birst_reg_staging_test where evt_id = > 'ACSF17' > and status=0 limit 10; > QUERY PLAN > > ---

limit and query planner

2018-06-05 Thread armand pirvu
All Please see below explain analyze select * from sp_i2birst_reg_staging_test where evt_id = 'ACSF17' and status=0 limit 10; QUERY PLAN --