List:General Discussion« Previous MessageNext Message »
From:<prasad.ramisetti Date:September 4 2006 3:52am
Subject:RE: problem with InnoDB
View as plain text  
Hi Chris,

Thanks for your response.

Actually there is some requirement, where I need to know the number of
rows that I will get for my queries before actually executing the query.
Could you please suggest some way for this.


-----Original Message-----
From: Chris [mailto:dmagick@stripped]
Sent: Wednesday, August 16, 2006 9:58 AM
To: Prasad Ramisetti (WT01 - Broadband Networks)
Cc: mysql@stripped
Subject: Re: problem with InnoDB

prasad.ramisetti@stripped wrote:
> Hi ,
> select count(*) is painfully slow in case of innoDB when the number of

> records are around 1 million. Ths select count(*) query in myISAM
> takes
> 0.01 secs and the same query in InnoDB takes around 20.15 secs.
> Can anybody suggest me how to speed up this query ?

You can't.

InnoDB is transactional which means it can't keep basic information like
the number of rows it has up to date (which means any number of inserts/
updates/deletes can happen at one time).

MyISAM is not transactional (so only one insert/update/delete can happen
at one time) so it can keep this information.

What context are you trying to do a count in? Maybe it would be better
to have an extra field in another table and keep that counter up to

I know this relates to postgresql but the same idea could be useful for

The information contained in this electronic message and any attachments to this message
are intended for the exclusive use of the addressee(s) and may contain proprietary,
confidential or privileged information. If you are not the intended recipient, you should
not disseminate, distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this
email and any attachments for the presence of viruses. The company accepts no liability
for any damage caused by any virus transmitted by this email.
RE: problem with InnoDBprasad.ramisetti4 Sep
  • Re: problem with InnoDBDan Nelson4 Sep
RE: problem with InnoDBprasad.ramisetti7 Sep
  • Re: problem with InnoDBChris7 Sep
  • Re: problem with InnoDBDouglas Sims7 Sep
  • Re: problem with InnoDBDan Nelson7 Sep
    • Re: problem with InnoDBDouglas Sims7 Sep
RE: problem with InnoDBprasad.ramisetti7 Sep
  • Re: problem with InnoDBJochem van Dieten7 Sep
RE: problem with InnoDBprasad.ramisetti7 Sep
  • Re: problem with InnoDBPaul McCullagh7 Sep
    • Re: problem with InnoDBGabriel PREDA10 Sep