Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!
Which query is faster, select count(*) or count(pk)?
Which query is faster, select count(*) or count(pk)?
0
Leave a Comment
Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.
Answers
Definitely
select count(1)
is too much faster,The
count(pk)
is equal toselect count(1) where pk is not null
,In my case
select count(1)
takes 200ms but theselect count(id)
takes more than 20 seconds (the table has more than 10B records)!Also i think
select count(1)
andselect count(*)
are same