A
A
Alex Ivanov2016-11-18 02:01:14
MySQL
Alex Ivanov, 2016-11-18 02:01:14

Which SELECT will be faster and less stressful?

A JSON array of type ["Sony","Audi","Android"] is passed to the code, and so on for 1000 records. There are about 200,000 entries in the posts table and they have titles like Sony , audi - ie. exact match to the words in the array.
I need to select in an array those records that match. How to do better - iterate over JSON and make a request SELECT * from posts whete title='$var'
or a single request

SELECT * from posts where (title LIKE '$var1' or title LIKE '$var2' ... title LIKE '$var1000')
?
Or are there some more beautiful and options

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2016-11-18
@Protossan

SELECT * FROM `posts` WHERE `title` IN ('$var1', '$var2', '$var3')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question