Please #PostgreSQL hackers, we'd like to understand the significant performance difference between count(*) and count(1).https://twitter.com/lukaseder/status/1174621016187973632 …
-
Show this thread
-
-
Replying to @lukaseder
Hi Lukas, I'm running a Postgres 13 on MacOS (without any tuning) and wasn't able to reproduce it. It seems statement 1 performs slightly better, but the difference is so tiny, it could be just luck...
@pg_xocolatl@RhodiumToad : What do you think ?pic.twitter.com/KWFAOTxPsV
2 replies 0 retweets 1 like -
Was JIT enabled and was it used for this query? Because in my tests that seems to make a big difference.
1 reply 0 retweets 0 likes -
As the jit value default is on for postgres 13, I assume it is enabled, but I'll check.
1 reply 0 retweets 0 likes -
Whether JIT is actually used for a given query depends on plan costs vs. the jit_above_cost settings, so it's worth checking the explain analyze of the test query
1 reply 0 retweets 0 likes -
So, here are my `jit` settings. And both explain plans. The planner consider that the costs are the same for both queries and used the same plan for both.pic.twitter.com/oztp4omkiv
1 reply 0 retweets 0 likes -
So JIT is not in play in your test since the costs aren't high enough. How repeatable are your timings? Can you try the generate_series version?
1 reply 0 retweets 0 likes -
I tried and tried again with an even larger set, couldn't find jit involved in explain planspic.twitter.com/2uNw1H7cd2
1 reply 0 retweets 0 likes -
Did you compile with the --with-llvm option? (you can check via select setting from pg_config where name='CONFIGURE';) What are your actual timings for the generate_series version of the test?
2 replies 0 retweets 0 likes
Also SELECT pg_jit_available();
-
-
Replying to @AndresFreundTec @RhodiumToad and
You may have found it. I compiled Postgres 13 without any option. Is it the default ?pic.twitter.com/W224LfbjF9
1 reply 0 retweets 0 likes -
Replying to @l_avrot @RhodiumToad and
It's not built by default, because you need to install a dependency.
0 replies 0 retweets 0 likes
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.