I have created a table with
CREATE TABLE xy (
blub VARCHAR(50) NOT NULL,
z INT UNSIGNED NOT NULL,
PRIMARY KEY (blub)
)
and want to query many entries at once by the column ‘blub’. Currently I am using the simple query
SELECT blub, z FROM xy WHERE blub = '...'
which is much faster than
SELECT blub, z FROM xy WHERE blub = '...' OR blub = '...' OR '...
Is there any other way to make it faster and to merge all queries?
You can try an
inclause. I’m not certain it will be faster, but it will definitely be more succinct. For example:explainwill tell you which is actually fastest for your situation.