MySQL Forums
Forum List  »  MyISAM

Re: Composite index
Posted by: Julian Assange
Date: August 30, 2016 03:16AM

Hi!

Sorry, I missed to paste the PK on the create statement...

....
PRIMARY KEY (`id`),
....

Not sure why the optimizer would think it is dealing with innodb when the table is a Myisam. It does not say much for how smart the optimizer is if its unable to work out the nature of the table.

Changing the query to SELECT 1... makes no difference, primary is still in use.

mysql> explain select 1 from users where id = 828191 and cookie = 1656382;
+----+-------------+------------+-------+---------------------------+---------+---------+-------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+-------+---------------------------+---------+---------+-------+------+-------+
| 1 | SIMPLE | users | const | PRIMARY,idcookie | PRIMARY | 4 | const | 1 | |
+----+-------------+------------+-------+---------------------------+---------+---------+-------+------+-------+



Yeah, almost at all times the query should return true as users browse through with their cookie authenticating them.

The subsequent queries are mostly unrelated to the content of that table.

I dont use innodb because 1. it appears myisam is best for mostly selects and not so much update 2. I understand better how it works 3. I have used innodb in a smaller project and the size of a file ibdata1 has grown huge for a small database.

Options: ReplyQuote


Subject
Views
Written By
Posted
1706
August 26, 2016 05:44PM
794
August 27, 2016 01:55PM
804
August 28, 2016 06:18AM
1001
August 29, 2016 11:34PM
Re: Composite index
860
August 30, 2016 03:16AM
786
August 31, 2016 04:48PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.