Fastest SELECT query

Tags: databases, webdevelopment, programming.
By lucb1e on 2012-01-15 16:43:49 +0100

Just a quick post about some speedtests I did. I couldn't quickly find which way was the fastest.

TABLE t: col1, col2, col3, col4, col5 (a mix of integers and varchars)

SELECT * FROM t
Run 1: 3.722 miliseconds
Run 2: 3.742 miliseconds

SELECT `col1`, `col2`, `col3`, `col4`, `col5` FROM t
Run 1: 3.673 miliseconds
Run 2: 3.699 miliseconds

SELECT `col1`, `col2`, `col3`, `col4` FROM t
Run 1: 3.608 miliseconds
Run 2: 3.605 miliseconds

SELECT col1, col2, col3, col4 FROM t
Run 1: 3.603 miliseconds
Run 2: 3.616 miliseconds
lucb1e.com
Tip others about this page:   Share via Facebook  Share via Twitter  Share via Google+  Submit to Reddit  Recommend at StumbleUpon  Share by e-mail Submit at Hacker News


Comments:
Comments powered by Disqus
Another post tagged 'webdevelopment': PHP's in_array is slow - this works faster

Look for more posts tagged databases, programming or webdevelopment.

Previous post - Next post