Jump to content

count by sql query or by php?


aliento

Recommended Posts

You should definitely do it in your query rather than on the PHP side.  By doing it on the PHP side, you are forcing mysql to prepare a stream with information that will never actually be retrieved, it will only be used with mysql_num_rows, which isn't cost effective.

 

If you are having performance issues, then I would suggest persisting the count, but up until then you should be fine with a COUNT(comment id), especially if indexed correctly.

 

~awjudd

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.