@finesoft2009
Администратор сервера http://fns.kz/

Как оптимизировать представления mysql?

Как оптимизировать представления?
КОД:
select `A`.`lb0003_id` AS `lb0003_id`,`C`.`lb0101_id` AS `lb0101_id`,`C`.`lb0101_name1` AS `lb0101_name1`,`C`.`lb0101_name2` AS `lb0101_name2`,`C`.`lb0101_name3` AS `lb0101_name3`,`C`.`lb0101_name1_alt` AS `lb0101_name1_alt`,`C`.`lb0101_name2_alt` AS `lb0101_name2_alt`,`C`.`lb0101_name3_alt` AS `lb0101_name3_alt`,`C`.`lb0101_dateOfBirth` AS `lb0101_dateOfBirth`,`C`.`lb0101_idn` AS `lb0101_idn`,`C`.`lb0101_idCard_no` AS `lb0101_idCard_no`,`C`.`lb0101_idCard_dateOfIssue` AS `lb0101_idCard_dateOfIssue`,`C`.`lb0101_idCard_issuedBy` AS `lb0101_idCard_issuedBy`,`C`.`lb0101_idCard_validity` AS `lb0101_idCard_validity`,`C`.`lb0101_passport_no` AS `lb0101_passport_no`,`C`.`lb0101_passport_dateOfIssue` AS `lb0101_passport_dateOfIssue`,`C`.`lb0101_passport_issuedBy` AS `lb0101_passport_issuedBy`,`C`.`lb0101_passport_validity` AS `lb0101_passport_validity`,`C`.`lb0101_location1` AS `lb0101_location1`,`C`.`lb0101_address1` AS `lb0101_address1`,`C`.`lb0101_phone_home` AS `lb0101_phone_home`,`C`.`lb0101_phone_mobile1` AS `lb0101_phone_mobile1`,`C`.`lb0101_phone_mobile2` AS `lb0101_phone_mobile2`,`C`.`lb0101_comments` AS `lb0101_comments`,`C`.`lb0101_email` AS `lb0101_email`,`C`.`lb0101_representative_name` AS `lb0101_representative_name`,`C`.`lb0101_representative_details` AS `lb0101_representative_details`,`C`.`lb0101_created` AS `lb0101_created`,`C`.`lb0101_createdby` AS `lb0101_createdby`,`C`.`lb0101_deleted` AS `lb0101_deleted` from (`ru-rv-od`.`lb0101_client` `C` join `ru-rv-od`.`vw_lb0101_clientbyaccess1cache` `A` on((convert(`A`.`target_lb0003_id` using utf8) = `C`.`lb0101_createdby`)))
union
select `A`.`lb0102_lb0003_id` AS `lb0003_id`,`C`.`lb0101_id` AS `lb0101_id`,`C`.`lb0101_name1` AS `lb0101_name1`,`C`.`lb0101_name2` AS `lb0101_name2`,`C`.`lb0101_name3` AS `lb0101_name3`,`C`.`lb0101_name1_alt` AS `lb0101_name1_alt`,`C`.`lb0101_name2_alt` AS `lb0101_name2_alt`,`C`.`lb0101_name3_alt` AS `lb0101_name3_alt`,`C`.`lb0101_dateOfBirth` AS `lb0101_dateOfBirth`,`C`.`lb0101_idn` AS `lb0101_idn`,`C`.`lb0101_idCard_no` AS `lb0101_idCard_no`,`C`.`lb0101_idCard_dateOfIssue` AS `lb0101_idCard_dateOfIssue`,`C`.`lb0101_idCard_issuedBy` AS `lb0101_idCard_issuedBy`,`C`.`lb0101_idCard_validity` AS `lb0101_idCard_validity`,`C`.`lb0101_passport_no` AS `lb0101_passport_no`,`C`.`lb0101_passport_dateOfIssue` AS `lb0101_passport_dateOfIssue`,`C`.`lb0101_passport_issuedBy` AS `lb0101_passport_issuedBy`,`C`.`lb0101_passport_validity` AS `lb0101_passport_validity`,`C`.`lb0101_location1` AS `lb0101_location1`,`C`.`lb0101_address1` AS `lb0101_address1`,`C`.`lb0101_phone_home` AS `lb0101_phone_home`,`C`.`lb0101_phone_mobile1` AS `lb0101_phone_mobile1`,`C`.`lb0101_phone_mobile2` AS `lb0101_phone_mobile2`,`C`.`lb0101_comments` AS `lb0101_comments`,`C`.`lb0101_email` AS `lb0101_email`,`C`.`lb0101_representative_name` AS `lb0101_representative_name`,`C`.`lb0101_representative_details` AS `lb0101_representative_details`,`C`.`lb0101_created` AS `lb0101_created`,`C`.`lb0101_createdby` AS `lb0101_createdby`,`C`.`lb0101_deleted` AS `lb0101_deleted` from (`ru-rv-od`.`lb0101_client` `C` join `ru-rv-od`.`vw_lb0102_client_access_actual` `A` on((`A`.`lb0102_client_lb0101_id` = `C`.`lb0101_id`)))
  • Вопрос задан
  • 226 просмотров
Пригласить эксперта
Ответы на вопрос 2
MaxDukov
@MaxDukov
впишусь в проект как SRE/DevOps.
выложите EXPLAIN запроса и описание учавствующих в запросе таблиц - может что и посоветуем
Ответ написан
@finesoft2009 Автор вопроса
Администратор сервера http://fns.kz/
04f7ae1d4e974239ba504ddb32481d80.png
(не обращайте внимания на закраску там ru-rv-od, просто переименовал)

vw_lb0101_clientbyaccess1cache - Таблица (Отображение строк 0 - 342 (343 всего, Запрос занял 0.0007 сек.))
vw_lb0102_client_access_actual - Представление (Отображение строк 0 - 16 (Отображение строк 0 - 17 (18 всего, Запрос занял 0.0016 сек.))) Размер - 16 КиБ
cef05b19b61741d78bf6b64c3cff8ea1.png

EXPLAIN SELECT * FROM `vw_lb0101_clientbyaccess`
e2a6eee3d9524cf886e235279029a892.png
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

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