GriefCode Posted September 30, 2015 Posted September 30, 2015 Hey, since i have run in some issues with my database i decided to log slow queries, and i found the basic amount on IPS side with a lot slow queries, just as small example: /*IPS\Patterns\_ActiveRecordIterator::count:62*/ SELECT cms_custom_database_2.*, author.*, last_commenter.*, core_tags_cache.tag_cache_text FROM `cms_custom_database_2` LEFT JOIN `core_tags_cache` ON tag_cache_key=MD5(CONCAT('cms;records2;',cms_custom_database_2.primary_id_field)) LEFT JOIN `core_members` AS `author` ON author.member_id = cms_custom_database_2.member_id LEFT JOIN `core_members` AS `last_commenter` ON last_commenter.member_id = cms_custom_database_2.record_last_comment_by WHERE ( cms_custom_database_2.record_approved=1 OR ( cms_custom_database_2.record_approved=0 AND ( cms_custom_database_2.member_id=10 ) ) ) AND cms_custom_database_2.category_id IN(2,3,4,5) ORDER BY record_pinned DESC, record_publish_date desc LIMIT 0,10; /*IPS\_Member::reportCount:10942*/ SELECT COUNT(*) FROM `core_rc_index` WHERE status IN( 1, 2 ) AND ( perm_id IN (SELECT perm_id FROM `core_permission_index` WHERE ( ( FIND_IN_SET('*',perm_view) OR FIND_IN_SET(13,perm_view) OR FIND_IN_SET(21,perm_view) ) )) OR perm_id IS NULL ); /*IPS\Patterns\_ActiveRecordIterator::count:62*/ SELECT forums_posts.*, forums_topics.* FROM `forums_posts` STRAIGHT_JOIN `forums_topics` ON forums_posts.topic_id=forums_topics.tid AND ( NULLIF(forums_topics.moved_to, '') IS NULL ) AND ( forums_topics.approved=1 OR ( forums_topics.approved=0 AND forums_topics.starter_id=10 ) ) STRAIGHT_JOIN `core_permission_index` ON core_permission_index.app='forums' AND core_permission_index.perm_type='forum' AND core_permission_index.perm_type_id=forums_topics.forum_id AND (( ( FIND_IN_SET(13,perm_2) OR FIND_IN_SET(21,perm_2) ) ) OR perm_2='*' ) LEFT JOIN `forums_forums` ON forums_topics.forum_id=forums_forums.id AND forums_forums.password IS NULL AND forums_forums.can_view_others=1 AND ( forums_forums.password IS NULL OR ( ( FIND_IN_SET(13,forums_forums.password_override) OR FIND_IN_SET(21,forums_forums.password_override) ) ) ) AND forums_forums.min_posts_view<=413 WHERE ( forums_forums.can_view_others=1 OR forums_topics.starter_id=10 ) AND queued=0 ORDER BY post_date DESC LIMIT 5; SELECT COUNT(*) FROM `core_members` WHERE name<>'' AND email<>''; The third one is a boomer, nearly locked a table for almost 1 second. The last one is categorized as slow query because 'name' got not indexed. Is there any plan to work also against slow queries, or are they 'passable' because they aren't executed that often (maybe, i dont know?)? Regards
Tomasz Janusz Posted October 6, 2015 Posted October 6, 2015 Hi IPS, Why has not anyone responded to this post? ActiveRecord apparently does not serve you in writing optimized queries ...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.