on 09-23-2015 11:11 AM
Hi folks, just wondering if there is any performance differences in using count(*) or count(id) to get the row count from a column table in HANA? Where "id" say is the primary key in the table.
Some Googling of behavior in other DB engines suggests that they are optimized for using count(*) and this should be faster to get a row count instead of using count(id). Wondering if it is the same with HANA?
And it's DB MYTHS TIME again...
Even with other DBMS engines this is a mostly wrong claim.
Most query optimizers nowadays recognize what should be done with a count(*) and optimize accordingly.
This is where it is important to check for proofs of such claims and the software versions they should be valid for!
Anyhow, SAP HANA does understand what should be done with a count(*) (count all visible rows) and optimizes for that.
I highly recommend to use COUNT(*) because
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.