# Slow queries with very large table

**URL:** <https://forums.percona.com/t/slow-queries-with-very-large-table/3185>\
**Category:** Other MySQL® Questions\
**Created:** [January 7, 2014, 11:25am UTC](https://forums.percona.com/t/slow-queries-with-very-large-table/3185 "2014-01-07T11:25:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![enrique](https://avatars.discourse-cdn.com/v4/letter/e/b9bd4f/32.png) [@enrique](https://forums.percona.com/u/enrique)\
**Post date:** [January 7, 2014, 11:25am UTC](https://forums.percona.com/t/slow-queries-with-very-large-table/3185/1 "2014-01-07T11:25:57Z")

</div>

Slow queries with very large table

---

<div class="post-metadata">

**Author:** ![niljoshi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/niljoshi/32/16889_2.png) [@niljoshi](https://forums.percona.com/u/niljoshi)\
**Post date:** [January 9, 2014, 3:50am UTC](https://forums.percona.com/t/slow-queries-with-very-large-table/3185/2 "2014-01-09T03:50:56Z")

</div>

Hi,

In InnoDB, count(_) will not work like MyISAM (row count stored in table files). So when you run count(_) on InnoDB , it will find small index of the table and then check counts and specially when you are running count on primary key, it will do full table scan as Primary key is clustered in InnoDB. That’s why it’s taking too much time. After first time running, its possible that data will be cache in Query cache OR buffer pool so second and third time it will be faster.

Partitions can be the better option to divide the data in multiple tables.

---

<div class="post-metadata">

**Author:** ![enrique](https://avatars.discourse-cdn.com/v4/letter/e/b9bd4f/32.png) [@enrique](https://forums.percona.com/u/enrique)\
**Post date:** [January 9, 2014, 5:24am UTC](https://forums.percona.com/t/slow-queries-with-very-large-table/3185/3 "2014-01-09T05:24:14Z")

</div>

Hello,

Thanks for your feedback.

Because we are using InnoDB, I’m wondering if migrating to Percona server (either 5.5 which will be as a quick replacement, or 5.6) would mitigate partially this performance problems, as I know Percona has XtraDB which is a InnoDB engine but with great optimisations.

Best regards,  
Enrique
