Re: Is there something wrong with my test case? - Mailing list pgsql-general

From Thiemo Kellner
Subject Re: Is there something wrong with my test case?
Date
Msg-id 20190107103051.Horde.Fv5QLwBG7xGA0puZV2lytxu@webmail.gelassene-pferde.biz
Whole thread Raw
In response to Re: Is there something wrong with my test case?  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
Responses Re: Is there something wrong with my test case?  (Fabio Pardi <f.pardi@portavita.eu>)
List pgsql-general
Hi HP

Thanks for your reply.

Quoting "Peter J. Holzer" <hjp-pgsql@hjp.at>:

> On 2018-12-25 11:54:11 +0000, Thiemo Kellner wrote:
> [three different but functionally equivalent queries]
>
>> Explain analyze verbose showed for:
>> A (cost=264.72..626.97 rows=31 width=90) (actual time=1.117..1.117 rows=0
>> loops=1)
>> C (cost=0.42..611.19 rows=31 width=52) (actual time=2.217..2.217 rows=0
>> loops=1)
>
> 626.97 doesn't seem "much higher" to me than 611.19. I would call that
> "about the same".
>

So would I but the cost is given as a range. Taking the the average  
somewhat 400 compare to somewhat 300. I do not know whether averaging  
is appropriate here.

> This is weird. C takes almost exactly twice as long as A, and while
> humans aren't very good at estimating times, One second should feel
> faster than two, not slower, and certainly not slower by far. Is it
> possible that your subjective impression wasn't based on the executions
> you posted but on others? Caching and load spikes can cause quite large
> variations in run time, so running the same query again may not take the
> same time (usually the second time is faster - sometimes much faster).

I am pretty sure not to have confused the association of my felt time  
measure to the query. I did run the script several times but as the  
script create everything anew this might not have any impact caching  
wise. However, if caching had an impact it just would add to the  
discrepancy between feeling that the first statement was much faster  
than the supposedly optimal statement. Being as may, there is still  
fact that cost for A was estimated  about the same as C or much higher  
but A was executed in half of the time of C.

-- 
Signal: +49 1578 7723737
Handys: +41 78 947 36 21 | +49 1578 772 37 37
Tox-Id:  
B7282A9E31D944DDAD1ECC5B33C36AAE80B32D119AB7391D602C937A65E8CA0625C495C5322B



pgsql-general by date:

Previous
From: Thomas Güttler
Date:
Subject: Re: Use bytearray for blobs or not?
Next
From: Thiemo Kellner
Date:
Subject: Re: Is there something wrong with my test case?