Having trouble finding this answer. If I search for a record by a primary key id does mysql automatically stop searching after it finds 1 record if there was no "limit" in the query?
Say a table has 1 billion records and I search for id = 1 and id is the primary auto incrementing key in the table. SELECT * FROM logs WHERE id IN(1) Will that query stop after it finds one or search the whole billion records even after finding a match?
I am asking because a model in a framework I am using that auto-builds db queries builds them like this including using "IN(id)" instead of id = # which is why the example shows it that way.
I want to use the database model a cleanly as possible but if it has a performance issue because of how it builds the query when dealing with 1 record I have to add more code to manually specify a limit. The model also builds updates the same way I assume mysql will handle the select and update on the primary key the same way (stopping after 1 found/updated or not).