Mavrikii
Platinum Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору SergGur сорри, только сейчас понял в чем вопрос, так и нужно было показать.. я не смотрел на запросы создания индексов. думал, что идет речь именно об biID Цитата: Это два индекса на два разных поля? | это два индекса на одно поле. но unique уже должен быть индексированным и использоваться. тут есть еще одна оособенность - MySQL не всегда использует индексы, если и есть, когда считает, что перебор будет быстрее. хотя может и ошибаться. Цитата: Scanning the table is faster Paradoxically, an index is only sometimes the fastest way to access data! The MySQL optimizer will always try to pick the quickest way to get the data it needs, which sometimes means choosing a slightly counter-intuitive method. For small tables or queries that select a large portion of a table, it can be faster for MySQL to skip the index scan and scan the table directly. Sometimes the dreaded table scan is the best access method possible! An index is a secondary data structure (a B+ tree) apart from the table that must be traversed to find the matching row IDs. Once the IDs have been found, those rows must be found and read from disk. In situations where most of the rows will be fetched, reading all of the rows in order off of the disk is faster than going to the index first. Usually, a table scan is bad news, but sometimes, even if rarely, it's the best possible outcome. | можно попробовать заставить использовать индекс - ... FROM tablename FORCE INDEX (имя_индекса) https://stackoverflow.com/questions/20797475/mysql-force-index-vs-use-index общая информация - https://dev.mysql.com/doc/refman/8.0/en/mysql-indexes.html в любом случае, тогда не нужен и biID вообще. ps: я воспроизвел первую ситуацию, все ок | Всего записей: 15121 | Зарегистр. 20-09-2014 | Отправлено: 23:11 21-09-2023 | Исправлено: Mavrikii, 23:18 21-09-2023 |
|