내 데이터베이스에 대한 액세스가 매우 느린 이유는 무엇입니까?

내 데이터베이스에 대한 액세스가 매우 느린 이유는 무엇입니까?

예전에는 완벽하게 작동했던 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

그런데 일반 시작 시 왜 이렇게 오래 기다려야 합니까? 이것은 매우 큰 데이터베이스가 아니며(편집: <10MB) 데이터가 손상된 것 같지 않습니다(시작 후 모든 것이 괜찮아 보입니다). 동시에 mysql 서버에 연결하는 다른 클라이언트가 없으며(명령과 함께 하나의 프로세스만 표시됨 show full processlist) 이미 서비스를 다시 시작했습니다 mysqld.

무슨 일이야 ?

답변1

내 생각엔 문제는 다음에서 비롯된 것 같아.자동 재해시 기능

오늘 이걸 시험해봤는데

mysql 프롬프트에서 다음을 입력했습니다.

mysql> desc outbound_

나는 탭을 두 번 쳤고 다음을 얻었습니다.

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_

내가 선택할 수 있도록 모든 데이터베이스와 테이블이 나타났습니다.

분명히 mysql 클라이언트는 데이터베이스를 읽어야 합니다 information_schema. mysql 인스턴스에 InnoDB 테이블이 많이 포함되어 있으면 데이터베이스를 auto-rehash읽을 수 있을 때까지 mysql 클라이언트가 정지되는 것을 볼 수 있습니다 information_schema.

답변2

[mysql]에 다음을 추가하면(d로 끝나지 않음) 응답 시간이 크게 단축됩니다.

no-auto-rehash

답변3

모두 감사합니다. 문제에 대한 답을 찾았습니다. 데이터베이스의 테이블 중 하나에 액세스할 수 없습니다.

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은 해당 파일의 데이터에 액세스하려고 시도하기 때문에 시작 시 시간이 너무 오래 걸립니다.

관련 정보