REALLY Slow Queries…….. Help! :)
-
Hello! I am using your plugin with BuddyPress and rtMedia Pro. I am happy that there is finally a plugin out there that can do the pagination work.
My problem is with (really) slow queries. The server is an 8 core CPU with 16GB of memory, and it is a dedicated server. Load averages are usually under 1. Everything on the site loads really fast, except for the galleries.
It took a while to figure out how to make the shortcodes work (the double array threw me off!). Here is the shortcode I am using:
[mla_gallery tax_query="array( array( 'taxonomy' => 'rt_female', 'field' => 'slug', 'terms' => 'other' ) )" buddypress_urls='true' orderby='date DESC' posts_per_page=48 mla_output="paginate_links,prev_next" mla_nolink_text='No Gallery Pages'] [mla_gallery tax_query="array( array( 'taxonomy' => 'rt_female', 'field' => 'slug', 'terms' => 'other' ) )" buddypress_urls='true' orderby='date DESC' posts_per_page=48 mla_caption="{+title+}"] [mla_gallery tax_query="array( array( 'taxonomy' => 'rt_female', 'field' => 'slug', 'terms' => 'other' ) )" buddypress_urls='true' orderby='date DESC' posts_per_page=48 mla_output="paginate_links,prev_next" mla_nolink_text='No Gallery Pages']
The amount of images we have is very considerable. 90,628 images in total. 15,170 videos. Each video has 3 thumbnails, which do not have a taxonomy, but count in the images total. The rt_female / other taxonomy has 628 images in it. The rt_male / main taxonomy has 14,493 images in it.
Now with the 628 image set to load, each page takes 130 seconds or so to load.
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_posts AS p2 ON (p2.ID = p2.ID) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (3) ) AND (wp_posts.post_mime_type LIKE 'image/%') AND wp_posts.post_type = 'attachment' AND (((wp_posts.post_status = 'inherit') OR (wp_posts.post_status = 'inherit' AND (p2.post_status = 'inherit')))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 480, 48 <strong>Time: 69.0391s</strong> Component media-library-assitant Affected Rows: 13
and another one for the same page:
SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_posts AS p2 ON (p2.ID = p2.ID) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (3) ) AND (wp_posts.post_mime_type LIKE 'image/%') AND wp_posts.post_type = 'attachment' AND (((wp_posts.post_status = 'inherit') OR (wp_posts.post_status = 'inherit' AND (p2.post_status = 'inherit')))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 480, 48 <strong>Time 68.4949s</strong> Component media-library-assitant Affected Rows: 13
If I change the taxonomy to one of the sub-taxes with 14,493 images in it, I cant even get pages to load without having dinner, sleeping, and then eating breakfast first. ??
I naturally explored the caching options, and I couldnt find a setting that helped. The “Cached” dropdown option in general settings is enabled by default, so the next time you load the page, it only takes 2 or 3 seconds. But when you go to a pagination page that hasnt been loaded, the results are clearly a very long wait.
With soooooooo many pages upon pages of images, and more images being added every few minutes of the day, I’m not certain that the server could even keep it up without crashing as for the two minutes each page takes 100% of the CPU for the full 2 minutes of load time per page, so it only would take 8 people loading pages to effectively crash the entire server.
Is there a better way of doing this so queries dont take so long? Or any suggestions of settings to tweak? Did I write the shortcode wrong? Maybe a way to statically generate the pages and set a cron to update them every 4 hours? Not really sure how to tackle this huge issue. Help a girl out! ?? <3
Cordially, and thanks!!!
Alexa
- The topic ‘REALLY Slow Queries…….. Help! :)’ is closed to new replies.