MySQL Forums :: Newbie :: any faster select count(*)


Advanced Search

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(*) Antony Lai 01/15/2012 04:17AM
Re: any faster select count(*) laptop alias 01/15/2012 06:20AM
Re: any faster select count(*) Antony Lai 01/15/2012 12:27PM
Re: any faster select count(*) irek kordirko 01/15/2012 04:41PM
Re: any faster select count(*) Antony Lai 01/16/2012 03:50AM
Re: any faster select count(*) irek kordirko 01/15/2012 06:51AM
Re: any faster select count(*) irek kordirko 01/16/2012 04:42PM
Re: any faster select count(*) laptop alias 01/16/2012 04:51PM
Re: any faster select count(*) Shawn Taylor 01/17/2012 09:18AM
Re: any faster select count(*) Rick James 01/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.