Title: [resolved] Optimizing query need!
Last modified: August 21, 2016

---

# [resolved] Optimizing query need!

 *  Resolved [capSheridan](https://wordpress.org/support/users/capsheridan/)
 * (@capsheridan)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/resolved-optimizing-query-need/)
 * You use CONCAT in queryes, but it has very long execution time with cerrent code.
   
   Please just replace CONCAT(‘{$table_name}_’, {$primary_key}) with CONCAT(‘{$table_name}_’,
   cast({$primary_key} as char)) in mixin.nextgen_table_extras.php
 * This small change is allowed to perform query on my database for 0.8 seconds 
   instead of 20
 * About problem: [http://www.mysqlperformanceblog.com/2007/10/16/be-careful-when-joining-on-concat/](http://www.mysqlperformanceblog.com/2007/10/16/be-careful-when-joining-on-concat/)

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

 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/resolved-optimizing-query-need/#post-4378703)
 * [@capsheridan](https://wordpress.org/support/users/capsheridan/) – Thank you 
   very much for the feedback … I will have our developers review your suggestion!
 * – Cais.
 *  Thread Starter [capSheridan](https://wordpress.org/support/users/capsheridan/)
 * (@capsheridan)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/resolved-optimizing-query-need/#post-4378707)
 * Thank you. 🙂
    Let them look at the query execution plan with and without change.
   They’ll all understand.
 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/resolved-optimizing-query-need/#post-4378711)
 * [@capsheridan](https://wordpress.org/support/users/capsheridan/) – Your suggestion
   seems very straight forward … I’m hoping it will be reviewed and addressed for
   our next (beta) release.
 * I’m sure something like this will have definite load time improvements across
   the entire plugin user base.
 * – Cais.
 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/resolved-optimizing-query-need/#post-4378887)
 * [@capsheridan](https://wordpress.org/support/users/capsheridan/) – Just a quick
   update, your suggestion has been committed and can be expected in the next (beta)
   release.
 * Thank you very much for your contribution!!
 * – Cais.

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

The topic ‘[resolved] Optimizing query need!’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

## Tags

 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * 4 replies
 * 2 participants
 * Last reply from: [photocrati](https://wordpress.org/support/users/photocrati/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/resolved-optimizing-query-need/#post-4378887)
 * Status: resolved