MySQL count rows performance -


It is better to calculate the total number of records for a storage

  • From TBL select

    pk = 1

or

   mysql_num_rows < / Code> at 

  • Receiving the array and selecting "Total" value from

      from count (*) to TBL as a total Get where pk = 1  

?

The latter can take the price directly from PK's index, whereas in the east almost certainly A table scan is required (unless every single column is not part of an index, and still, it has to get value from all indexed) How are you connecting to DB? Based on this, there is a large amount of data transmittance to get the count.

Here can help you in this situation, it will tell you that selection is optimized.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -