▲ | Guillaume86 14 hours ago | |||||||||||||||||||||||||||||||
Only if your table is missing an unique index on that column, which it should have to enforce your assumption, so yeah LIMIT 1 is a code (or schema in the case) smell. | ||||||||||||||||||||||||||||||||
▲ | dotancohen 13 hours ago | parent [-] | |||||||||||||||||||||||||||||||
IDs are typically unique primary key. But in my experience, adding LIMIT 1 would on average halve the time taken to retrieve the record. I'll test again, really the last time I tested that was two decades ago. | ||||||||||||||||||||||||||||||||
|