MYSQL and the LIMIT clause

Posted by Lizard on Stack Overflow See other posts from Stack Overflow or by Lizard
Published on 2010-05-12T12:05:32Z Indexed on 2010/05/12 12:14 UTC
Read the original article Hit count: 268

I was wondering if adding a LIMIT 1 to a query would speed up the processing?

For example...

I have a query that will most of the time return 1 result, but will occasionaly return 10's, 100's or even 1000's of records. But I will only ever want the first record.

Would the limit 1 speed things up or make no difference?

I know I could use GROUP BY to return 1 result but that would just add more computation.

Any thoughts gladly accepted!

Thanks

© Stack Overflow or respective owner

Related posts about mysql

Related posts about php