MySQL Forums
Forum List  »  Newbie

any faster select count(*)
Posted by: Antony Lai
Date: January 15, 2012 04:17AM

Dear All,

I just want to check a piece of data is exist in a table or not. Someone told me this:
1) select count(*) from table1 where index_column = 'xxx'; // is slow

it should be:
2) select count(index_column) from table1 where index_column = 'xxx';

OR
3) select 1 from table1 where index_column = 'xxx';

OR
4) select count(1) from table1 where index_column = 'xxx';


Is it true? Thank you very much!

Best Regards,
Antony

Options: ReplyQuote


Subject
Written By
Posted
any faster select count(*)
January 15, 2012 04:17AM
January 15, 2012 06:20AM
January 15, 2012 12:27PM
January 16, 2012 03:50AM
January 16, 2012 04:51PM
January 17, 2012 09:18AM
January 19, 2012 01:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.