Does anyone know if there is a difference in speed (obviously, for sufficiently significant tables) between these two queries:
SELECT field FROM table WHERE primary_key = "a particular value"
or
SELECT field FROM table WHERE primary_key = "a particular value" LIMIT 0,1
I should note that the field primary_keyis actually the primary key.
Now it LIMIT 0,1helps when the request otherwise will look for other matches. I assume that when the primary key is enabled, it should automatically stop due to its uniqueness. Therefore, I assume that there will be no gain by adding it.
Has anyone come across this before? At the moment, I do not have a sufficiently large data set. I also assume that the same answer will apply for any field that has been set as UNIQUE.
Pebbl source
share