I have added and removed a few indexes from my user table and, while testing, didn't see the performance gains I had hoped. As a result, I removed the indexes and tried a simple query to see what my baseline speed is.
With so few records in the table, it seems like this "baseline speed" should be way faster, but I'm not experienced in MySQL performance tuning, so I'm not sure.
My user table (InnoDb) has 4344 records.
If I run select firstName from user;
the query takes roughly 0.5 seconds to complete.
Thanks in advance for any insight:
+-----------------------+------------------+------------+---------------+ | Field | Type | Allow Null | Default Value | +-----------------------+------------------+------------+---------------+ | userId | int(10) UNSIGNED | No | | | email | varchar(150) | No | | | password | varchar(50) | Yes | | | passwordSalt | varchar(50) | Yes | | | firstName | varchar(50) | Yes | | | lastName | varchar(50) | Yes | | | country | varchar(50) | Yes | | | phone1 | varchar(10) | Yes | | | phone2 | varchar(10) | Yes | | +-----------------------+------------------+------------+---------------+
EXPLAIN
andEXPLAIN ANALYSE
for querySELECT firstName FROM USER
ask something more specific. If you don't understand the output then post it here.(filename)
if you want to improve efficiency of the specific query. And why did you remove the other columns from the table description? Even one very wide varchar column, like the (800) you have, matters for the efficiency of a table scan. Also please note that theSHOW CREATE TABLE
output is far more useful than theDESCRIBE
output (we can see indexes, character sets, engine used, etc.)(filename)
did you meanfirstName
? I will add the columns back and display the table using theshow create table
syntax as requested. As to your question of why I removed them, I thought maybe it didn't matter and didn't want to expose so much of the tables structure if it wasn't necessary. I'll try adding the index tonight as you suggested.