does setting a column to index in a mysql table ensure O(1) look ups?
问题 so when there's an index on a column, and you do a simple SELECT * FROM table WHERE indexed_column = value, is that a O(1) search? does it matter whether the contents indexed are integers or string? 回答1: None of the lookups in MySQL's MyISAM or InnoDB storage engines are O(1) searches. Those storage engines use B+Trees to implement indexes. The best they can do is O(log 2 n) searches. The MEMORY storage engine uses a HASH index type by default, as well as the B+Tree index type. Only the HASH