I wanted to know that does MySQL store and update the total number of rows each time a row is added or removed, or does it count rows when asked?
I’m asking this because, if it counts, it will impact applications with speed. If there are 2 million rows, it will take time to count?
So what does it do?
Thanks. 😀
I wanted to know that does MySQL store and update the total number of
Share
Depends on your storage engine. MyISAM keeps track of the row count, while InnoDB counts. But you should rather benchmark and see if it is really as slow as you think. I would think that there are much worse queries in your application than counting rows – especially if it takes a long time.