Почему доступ к моей базе данных очень медленный? [закрыто]

У меня есть база данных mysql, которая раньше работала отлично, но теперь она очень медленно запускается. Когда я набираю

$> mysql -u foo bar

, я получаю следующее обычное сообщение в течение примерно 30 секунд, прежде чем получаю подсказку:

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Конечно, я пробовал, и это происходит намного быстрее:

$> mysql -u foo bar -A

Но почему я должен так ждать долго в штатном автозагрузке? Это не очень большая база данных (редактирование: <10 МБ), и данные, похоже, не повреждены (после запуска все выглядит нормально). У меня нет другого клиента, подключающегося к серверу mysql одновременно (только один процесс показан с командой show full processlist ), и я уже перезапустил службу mysqld .

Что происходит?

4
задан 15 October 2012 в 18:44
3 ответа

Add the following to your [mysql] (notice it doesn't end with d) and it will greatly speed up your response time:

no-auto-rehash
2
ответ дан 3 December 2019 в 03:45

I think the problem stems from the auto-rehash feature

I tried this out today

At the mysql prompt, I typed

mysql> desc outbound_

I hit the tab twice and got the following

mysql> desc outbound_
outbound_call_id                      outbound_log.ext                      outbound_log.template_id
outbound_log                          outbound_log.failed                   outbound_log.transfer_connected
outbound_log.DealerVoiceProviderType  outbound_log.icallclick_alert         outbound_log.transfer_duration
outbound_log.VoipCallStatusType       outbound_log.isService                outbound_log.transfer_ended
outbound_log.VoipTransferStatusType   outbound_log.lead_id                  outbound_log.transfer_ext
outbound_log.call_duration            outbound_log.outbound_log_id          outbound_log.transfer_phone
outbound_log.call_ended               outbound_log.phone                    outbound_log.transfer_started
outbound_log.call_started             outbound_log.postback                 outbound_log.transfer_status
outbound_log.call_type                outbound_log.recording_url            outbound_log.vehicle_id
outbound_log.called                   outbound_log.remote_call_id           outbound_log_id
outbound_log.callnote_synced          outbound_log.sales_id
outbound_log.dealer_id                outbound_log.scheduled
mysql> desc outbound_

Every database and table came up for me to choose

Evidently, mysql client has to read the information_schema database. If your mysql instance contains a lot of InnoDB tables, I can see auto-rehash stalling the mysql client until it can read information_schema database.

1
ответ дан 3 December 2019 в 03:45

Всем спасибо, я нашел ответ на свою проблему. Невозможно получить доступ к одной из таблиц из базы данных:

mysql> show columns from foo;
ERROR 1033 (HY000): Incorrect information in file: './db/foo.frm'

Связанный файл foo.frm больше не может быть прочитан.

$> cat foo.frm
cat: foo.frm: input/output error

Ошибка диска: / Mysql занимает так много времени при запуске, потому что пытается получить доступ к данным из этого файла.

0
ответ дан 3 December 2019 в 03:45

Теги

Похожие вопросы