When to use Count (PK_ID) and when to use system tables?

We can use either count(<column_name>)or system tables to get the number of rows in the table. Then where to use which?

Thanks Devi

+3
source share
3 answers

When COUNT(*)(without any conditions WHERE) it starts to take more than 10 seconds, when I usually cancel the request and start using system tables from now on. Obviously, if there are conditions WHERE, you can get an answer only through COUNT(*)(or COUNT(<column>))

Once the table is large enough to COUNT(*)not work well, you don't need an exact answer at all.

+1
source

/ , () . , .

+3

Use COUNT()whenever you need this number of rows from any table. Use system tables only if you need additional information other than the number of rows (for example, used space and what not).

0
source

All Articles