Geoff wrote:
> Is there any advantage in specifying "limit 1" or
> is that implicit in MySQL's analysis of the
> statement? i.e. does MySQL know that the primary
> key must be unique so it automatically stops after
> the first hit and doesn't go on to search for any
> other rows (even if "limit 1" is not specified)?
No. It will be optimized away by mysql and you shall see in the results of EXPLAIN SELECT that mysql is using a (const,const) primary key lookup with 1 row returned.
BTW, if speed is indeed critical, I would recommend trimming your data types to the INT column type instead of BIGINT. That is unless you *really* will be using > 4 billion unique iid values...
Jay Pipes
Community Relations Manager, North America, MySQL Inc.
Got Cluster?
http://www.mysql.com/cluster
Personal:
http://jpipes.com