165place
LiveZilla Mobile Wishlist All the ideas and discussions
0 votes Vote

Huge queries with count

Hi,

We are heavy users of the system and we have an issue with the database queries. We have a lot of groups and when we search for tickets or just access the ticket list, the system runs queries like this:

SELECT COUNT(*) AS `total`,(SELECT COUNT(*) FROM (SELECT `lz_tickets`.`id` FROM `lz_tickets`) AS `sta`) AS `totalperm`,(SELECT COUNT(*) FROM (SELECT `lz_tickets`.`id` FROM `lz_tickets` LEFT JOIN `lz_ticket_editors` AS `te` ON `lz_tickets`.`id`=`te`.`ticket_id` WHERE `deleted`=0 AND ((`te`.`status` IS NULL OR `te`.`status`=0 OR `te`.`status`=1) AND `te`.`editor_id`='fdda91e5730cabe') GROUP BY `lz_tickets`.`id` ORDER BY `lz_tickets`.`last_update` DESC) AS `stb`) AS `totalquery`,(SELECT COUNT(*) FROM `lz_tickets` LEFT JOIN `lz_ticket_editors` AS `te` ON `lz_tickets`.`id`=`te`.`ticket_id` WHERE `deleted`=0 AND (`target_group_id` IN ('ESApps','ESBuilderallBusiness','ESConstructores','ESDiseno','ESEmailProfesional','ESMailingBoss','ESPagamentos','ESTutorialesAPeticion','ESVideos','ESSupport','USSupport','USApps','USBuilderallBusiness','USBuilders','USDesign','USMailingBoss','USPayments','USVideos','USWebmail'))) AS `totalall`,(SELECT COUNT(*) FROM `lz_tickets` LEFT JOIN `lz_ticket_editors` AS `te` ON `lz_tickets`.`id`=`te`.`ticket_id` WHERE `deleted`=0 AND (`target_group_id` IN ('ESApps','ESBuilderallBusiness','ESConstructores','ESDiseno','ESEmailProfesional','ESMailingBoss','ESPagamentos','ESTutorialesAPeticion','ESVideos','ESSupport','USSupport','USApps','USBuilderallBusiness','USBuilders','USDesign','USMailingBoss','USPayments','USVideos','USWebmail')) AND `status`

Julio Rocha , 04.01.2019, 16:10
Idea status: under consideration

Comments

Leave a comment