I have a SQL query that uses the values of an array in its WHERE clause:
$ids = array
(
[0] => 1
[1] => 2
[2
-
Oracle has a limit of 1000, which I've hit before. MySQL doesn't seem to mind. The best solution is not to use an IN clause for that large a dataset though. Where do the ids come from? If from the same DB, then see if you can use a subquery instead that searches based on one parameter e.g. userid to find the linked ids. This will be far more efficient as MySQL can do a join internally using indexes.
- 热议问题