Title: Query length
Last modified: August 21, 2016

---

# Query length

 *  [ardufour](https://wordpress.org/support/users/ardufour/)
 * (@ardufour)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/query-length/)
 * Greetings Rachel,
 * I still have a problem with the plugin. The number of queries is low, but the
   query time is long. Here is an example from the admin (backend). The query length
   is 22.6 seconds :
 * SELECT wpposts.ID, (
    SELECT COUNT(*) FROM wp_postmeta wpmeta INNER JOIN wp_posts
   wpmetaposts ON wpmetaposts.ID = wpmeta.post_id AND wpmetaposts.post_type IN (‘
   actualites’,’commentaire-lecture’,’post’ ) AND wpmetaposts.post_status = ‘publish’
   WHERE wpmeta.meta_key = ‘_custom_post_type_onomies_relationship’ AND wpmeta.meta_value
   = wpposts.ID ) AS count FROM wp_posts wpposts WHERE wpposts.ID IN ( ‘1248’,’1249′,’
   1250′,’1251′,’1252′,’1253′,’1254′,’1255′,’1256′,’1257′,’1258′,’1259′,’1260′,’
   1261′,’1262′,’1263′,’1264′,’1265′,’1266′,’1267′,’1268′,’1269′,’1270′,’1271′,’
   15469′,’1207′,’1208′,’1209′,’1210′,’1211′,’1212′,’1213′,’1214′,’1215′,’1216′,’
   1217′,’1218′,’1219′,’1220′,’1221′,’1222′,’1223′,’1224′,’1225′,’1226′,’1227′,’
   1228′,’1229′,’1230′,’1231′,’1232′,’1233′,’1234′,’1235′,’1236′,’1237′,’1238′,’
   1239′,’1240′,’1241′,’1242′,’1243′,’1244′,’1245′,’1246′,’1247′ ) AND wpposts.post_status
   = ‘publish’ ORDER BY wpposts.ID ASC
 * Thank you again!
 * [https://wordpress.org/plugins/cpt-onomies/](https://wordpress.org/plugins/cpt-onomies/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/query-length/#post-4724493)
 * Hmm. I wonder why it’s so long? That doesn’t seem like too crazy of a query.
 * I’m quite literally just a few hours from getting on a plane to go on vacation
   so be patient with me and I’ll look into this as soon as I get back!
 *  Thread Starter [ardufour](https://wordpress.org/support/users/ardufour/)
 * (@ardufour)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/query-length/#post-4724550)
 * Greetings Rachel,
 * Do you have any news about my issue?
 * We have changed the server for the site, things are quite better, but we still
   have a 10 seconds loading time with some pages, especially the ones with CPT-
   onomies.
 * Thank you!
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/query-length/#post-4724551)
 * Looking into it right now! 🙂
 *  Thread Starter [ardufour](https://wordpress.org/support/users/ardufour/)
 * (@ardufour)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/query-length/#post-4724553)
 * I don’t know if it can help you figure it out, but I can send you a direct link
   to the pages that cause problems.
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/query-length/#post-4724554)
 * Please do. I’m so sorry. My time is just… not my own. Plus it’s hard for me to
   test this kind of stuff. I wonder if the part of the query that gets the term
   count is what’s slowing it down. Do you use the term count at all?
 *  Thread Starter [ardufour](https://wordpress.org/support/users/ardufour/)
 * (@ardufour)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/query-length/#post-4724555)
 * Since this site has currently content that can’t be public, I have sent you the
   link via your website’s webform.
 * The site is for a magazine. There is that “number” cpt that is associated to 
   book comments, articles and other ctp.
 * On the “number” page, I load every content associated to it. Here is a sample
   of the code used :
 *     ```
       if( $commentaires ) {
       							   ?><h3>Commentaires de lecture</h3>
       							   <ul><?php
       								  foreach ( $commentaires as $commentaire ) {
       									 ?><li><a href="<?php echo get_permalink( $commentaire->ID ) ?>" title="<?php echo get_the_title( $commentaire->ID ); ?>"><?php echo get_the_title( $commentaire->ID ); ?></a></li><?php
       								  }
       							   ?></ul><?php
       							}
       ```
   
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/query-length/#post-4724556)
 * I just setup something in my testing environment and it’s dragging the load so
   hopefully I’ll have an answer here soon.
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/query-length/#post-4724557)
 * I uploaded 2900 posts to test load time and just querying the posts alone makes
   for a slow query, let alone CPT-onomies.
 * Still looking…
 *  Thread Starter [ardufour](https://wordpress.org/support/users/ardufour/)
 * (@ardufour)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/query-length/#post-4724558)
 * I’m planning on using W3 Total Cache plugin, which will help with the loading
   speed.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Query length’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cpt-onomies_f2f2f2.svg)
 * [CPT-onomies: Using Custom Post Types as Taxonomies](https://wordpress.org/plugins/cpt-onomies/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cpt-onomies/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cpt-onomies/)
 * [Active Topics](https://wordpress.org/support/plugin/cpt-onomies/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cpt-onomies/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cpt-onomies/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [ardufour](https://wordpress.org/support/users/ardufour/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/query-length/#post-4724558)
 * Status: not resolved