Search Postgresql Archives

Re: Is there something wrong with my test case?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi HP

Thanks for your reply.

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

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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux