Categories
optimization sql

What is the best way to select multiple rows by ID in sql?

I need to select multiple records

I use

SELECT *
FROM `table`
WHERE `ID` =5623
OR `ID` =5625
OR `ID` =5628
OR `ID` =5621

this query runs 4 times per second with php

is there a better and faster way for this ?

SELECT *
FROM `table`
where ID in (5263, 5625, 5628, 5621)

is probably better, but not faster.