php - Getting total number of records from mysql table - too slow -
I have a file that goes through a large data set and divides lines into a paged way. There are about 210k rows, which is not very much, it will increase up to 3 miles + in a few weeks, but it has already slowed down.
I have one such query, in which the number of total items is DB for a special WHERE clause combination, the most basic one looks like this:
SELECT count It takes 0.9 seconds to run (v_id) from num_items versions like WHERE v_status = 1
.
The second query is a limited query that receives the actual data on that page. This question is really quick (under 0.001)
from v_id, v_title, v_desc in variants where v_status = 1 command v_dateadded DESC LIMIT 0, 25
There is an index on v_status, v_dateadded
I use php; I cache the results in the memcache, so later the requests are really fast, but the first request has been requested. In particular, once I throw it in a complete search, it starts taking 2-3 seconds for 2 questions.
I do not think this is correct, but try to count (*) it, I think Counting (x) is to go through each line and only those people who do not have zero value (hence it has to go through all the rows)
Given that v_id is a The primary key is
But I do not think it will help you Will, because you Has a section.
Comments
Post a Comment