Hi all,

I know I'm a bit late in coming to this discussion.  Glad to see that
this problem is on the InnoDB to-do list.

I will put out that one thing you can do is utilize triggers.  Make a
separate table with one field, and put a trigger on the table you want
counted so that every time there is an insert to the table, you
increment the field in the 2nd table.  Add a second trigger to
decrement the 'counter table' field every time a delete statement is
issued.  This should work.  It's a hack, but if you need that
implementation quickly, there ya go.

Granted, you need MySQL 5.0.

-Sheeri

On 11/1/05, Kevin Burton <[EMAIL PROTECTED]> wrote:
> MyISAM has a cool feature where it keeps track of the internal row
> count so that
>
> SELECT COUNT(*) FROM FOO executes in constant time.  Usually 1ms or so.
>
> The same query on INNODB is O(logN) since it uses the btree to
> satisfy the query.
>
> I believe that MyISAM just increments an internal count so that every
> insert/delete changes the count.
>
> Are there plans to add this to INNODB?  I was relying on this for my
> database monitoring app and noticed that it was killing my
> performance (I forgot about this problem...)
>
> Would be really nice to have.
>
> Kevin
>
> Kevin A. Burton, Location - San Francisco, CA
>        AIM/YIM - sfburtonator,  Web - http://www.feedblog.org/
> GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to