Все в innoDB и таблицы тегов тоже
примеры
Code: Select all
# Time: 160712 22:42:16
# User@Host: [] @ localhost []
# Query_time: 5.755823 Lock_time: 0.000193 Rows_sent: 120 Rows_examined: 64861
use xxxxxx;
SET timestamp=1468352536;
SELECT SQL_CALC_FOUND_ROWS gs.gallery_id, gs.thumb_id, gi.sponsor_id, gi.content_count, gi.content_type, gs.total_shows, gs.total_clicks, gs.total_ctr, gt.thumb_url, gd.*, gi.content_count, gi.crop_profile_id, gi.activation_date, gi.added_date, gi.duration, gi.url, gi.gallery_total_shows, gi.sponsor_id, gi.source_url, gi.custom_gallery FROM rot_gallery_stats1 as gs STRAIGHT_JOIN rot_gallery_data1 as gd on gd.gallery_id = gs.gallery_id
STRAIGHT_JOIN rot_gallery_info as gi on gi.gallery_id = gs.gallery_id
JOIN rot_thumbs as gt on gt.thumb_id = gs.thumb_id
WHERE 1 = 1 AND gi.gallery_status = 'active' AND gi.gallery_type = 0 and gs.best_thumb = 'yes' and gs.group_id = 0 AND gs.gallery_id IN (SELECT rot_gal2tag.gallery_id FROM rot_gal2tag WHERE rot_gal2tag.tag_id IN ('3148') ) ORDER BY tested_thumb DESC, gs.total_ctr DESC LIMIT 0, 120# queryitems;
SET timestamp=1468352403;
SELECT SQL_CALC_FOUND_ROWS gs.gallery_id, gs.thumb_id, gi.sponsor_id, gi.content_count, gi.content_type, gs.total_shows, gs.total_clicks, gs.total_ctr, gt.thumb_url, gd.*, gi.content_count, gi.crop_profile_id, gi.activation_date, gi.added_date, gi.duration, gi.url, gi.gallery_total_shows, gi.sponsor_id, gi.source_url, gi.custom_gallery FROM rot_gallery_stats1 as gs STRAIGHT_JOIN rot_gallery_data1 as gd on gd.gallery_id = gs.gallery_id
STRAIGHT_JOIN rot_gallery_info as gi on gi.gallery_id = gs.gallery_id
JOIN rot_thumbs as gt on gt.thumb_id = gs.thumb_id
WHERE 1 = 1 AND gi.gallery_status = 'active' AND gi.gallery_type = 0 and gs.best_thumb = 'yes' and gs.group_id = 0 AND gs.gallery_id IN (SELECT rot_gal2tag.gallery_id FROM rot_gal2tag WHERE rot_gal2tag.tag_id IN ('133') ) ORDER BY tested_thumb DESC, gs.total_ctr DESC LIMIT 0, 120# queryitems;







