when i use arrays mysql query it's really slow. are there any tricks that makes this faster?
e.g:
SELECT *
FROM posts
WHERE type IN ('1','2','5')
ORDER BY id ASC
takes much longer then other queries.
when i use arrays mysql query it's really slow. are there any tricks that makes this faster? e.g:
takes much longer then other queries. |
||||
If
If not - change |
|||
|
There a number of things to speed up queries I'd consider looking up the following: Normalizing. Perhaps the structure of your tables isn't the most efficient? Indexing. This will improve query times if you KNOW what you want to search on. |
|||
|
|
|||
|
Here you need to look two things First, ('1','2','5') this is string not integer it should be (1,2,5). Second, you can apply indexes on type field. |
|||
|
WHERE type=1 OR type=2 OR type=5
. Do you have got an index on type? – str Oct 30 '11 at 17:13IN
is logically equivalent; there's no benefit to usingOR
s – OMG Ponies Oct 30 '11 at 17:15