Suppose I have a table with 100,000 records, which in this example I will call the dictionary, and will have a LIMIT
of 1000 results.
SELECT FROM * dicionario
Let's say hypothetically I've already done a query and in this query I got the 1000 results ID and turned it into an array.
Considering performance at query time, it would be worth redoing SELECT
using the same condition in WHERE
, or it would be worth doing SELECT
using WHERE
the id that composes or array, something like:
$arrayId = 1, 20, 101, 345, 800, .... 7001.
SELECT FROM * dicionario WHERE id IN (". $arrayId .")
My question arose based on my current situation, where in fact I already have an array with the IDs, because that way I believe I would spare some SELECT, but I was worried about the performance and use of resources, such as memory.