April 13th, 2013, 04:04 AM
Preparing for testing "poor performance"
I am experimenting with indexes. I have a table now and filled it with 3 million rows with random dates. I was hoping for some poor performance when I tried the query below so I can add indexes and see how they work
But it works in less than a second: Showing rows 0 - 29 (233,513 total, Query took 0.0011 sec)How many records do I need to insert to experiment poor performance on a table like this?
April 13th, 2013, 06:06 AM
this query will never use any indexes
see if you can figure out why
April 13th, 2013, 06:16 AM
doesn't benefit from using index.
Indexes are used for two things:
1. Finding specific records (WHERE clause)
2. Or when you need records in a specific order (ORDER BY (and the way GROUP BY works internally it is used for this also)).
So the simplest query that will use an index is:
Then learn to use EXPLAIN ... and learn to read the output (it's a bit hard to begin with, but you need it to be able to work with optimizations).
WHERE someColumn = 'something'
Optimizations are fun