php - Joining a count query mysql for performance -
has been searched but can not find the answer that is in line with the exact requirements for this mysql query.
I have the following questions on several tables to generate "statistics" for a table:
SELECT COUNT (id) as `mod_ **` Publish with 'WHERE'; = '1'; Choose `mod _ ***` where 'published' = '1' by counting as COUNT (id); Select COUNT as Count (Mode) from `Mode _ ****`; Select number (ID) as counting from `id_ _ *****`;
Very easy to do sometimes sometimes calculates rows based on a situation.
However, in search of performance I would love to receive it in 1 query to save resources.
I am using php to get this data with the simplest mysql_fetch_assoc
and retrieving $ res [count]
If I make it a difference (the supporters are not guaranteed, even plain old mice).
Overhead to send a query and receive a single-line response
If you do not yet have a INDEX
index
published
columns will speed up the first two questions.
Comments
Post a Comment