Problem with queries related to polylang which break down my site
-
Hi there.
I got a problem with my site, which I guess is related with some implementation of Polylang, or the way Polylang treats translations.My site has 550 posts, which are translated to 3 languages.
It’s a site I have received for maintenance and I have no contact with the former developer.The problem is a huge massive sql 88K very slow query, that takes 1-2 seconds and runs with every user session, and when number of simultaneously users passing 10, the database gets locked up, and all the site crushes down.
It’s a nightmare.
The problematic query is:
SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('post_translations') AND tt.count > 0 ORDER BY t.name ASC
Which returns 89008 rows…..
Query Monitor identified the Caller like that:
WP_Term_Query->get_terms() // wp-includes/class-wp-term-query.php:759 WP_Term_Query->query() // wp-includes/class-wp-term-query.php:301 get_terms() // wp-includes/taxonomy.php:1237 rb_ext_VC_Config->extend_shortcodes() // wp-content/themes/setech/vc/rb_vc_config.php:104 do_action('init') //wp-includes/plugin.php:484
How do I know its related to Polylang?
1. When I disable polylang, the query doesn’t execute anymore.
2. I got 89K post_translations key values, inside “wp_term_taxonomy”.An example of post translations which repeats 89K times in my database:
a:3:{s:2:"pt";i:63868;s:2:"es";i:7833;s:2:"en";i:7876;}
Questions/doubts
1. Any idea why I get a query this large? Is it a bad implementation of the plugin?
2. Does post translation make sense to you? this amount of information?
3. Why does the query I mentioned at the start of this post need to return 88K results? Does it make any sense?Reference: Discussion on the subject, including print-screens, on SO
- The topic ‘Problem with queries related to polylang which break down my site’ is closed to new replies.