cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Sql COUNT Performance Question

Former Member
5,806

Structure of Example table:

Id, Integer (PK)
Name, Varchar(100)
Description, Text

I need to know if exists difference in performance between:

SELECT COUNT(*) FROM Example;

and

SELECT COUNT(Id) FROM Example;

Or does not exists differences?

View Entire Topic
MCMartin
Participant

If the exact value is not important, but you just want to get an idea if 1000 or 1Mio entries exists you can use the super fast access to the column count of systab. This value is updated during each successful checkpoint.

select count from systab where table_name = 'Example'

Use case is for instance: The application wants to display total count of customers in the database in its status bar, updated every 5min...

VolkerBarth
Contributor
0 Likes

@Breck: I wanted to correct "tabel_name", too, but seems unable to. Why don't I have an "edit" button for other people's post - am I still missing reputation in these times of boot-strapping?