Mysql Indexes, how much can I add the most?

I have fields id, member_id, topic_id. Sometimes I use idsometimes member_id, and sometimes topic_idin WHERE. Can I add indexes to all of them? Will it slow down? I am new to MYSQL optimization materials, so thanks.

+3
source share
2 answers

Unused indexes will not make SELECT slower, but each added index slows down INSERT and UPDATE.

The maximum number of indexes a MyISAM can have is 64

+4
source

, , , , :

SELECT * FROM your_table WHERE id = ?;
SELECT * FROM your_table WHERE member_id = ?;
SELECT * FROM your_table WHERE topic_id = ?;

id , , , . , member_id topic_id:

CREATE INDEX ix_your_table_member_id ON your_table (member_id);
CREATE INDEX ix_your_table_topic_id ON your_table (topic_id);

.

+2

Source: https://habr.com/ru/post/1752222/


All Articles