Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter NielsV_E

    (@nielsv_e)

    I made a dirty change in the mixin.netgen_table_extras.php …

    Line 153, function get_generated_query ()

    Added some limitations:
    $this->object->limit(20,0);
    $this->object->order_by($primary_key, “DESC”);

    We don’t use NextGen function for post_id’s (only use [ngggallery id=]), so I changed also the query:
    $sql = str_replace(‘FROM’, “, {$wpdb->options}.option_value AS ‘custom_post_id’, GROUP_CONCAT(CONCAT_WS(‘@@’, meta_key, meta_value)) AS ‘extras’ FROM”, $sql);

    in:
    $sql = str_replace(‘FROM’, “, ” AS ‘custom_post_id’, ” AS ‘extras’ FROM”, $sql);

    And also:
    $sql = str_replace($from, “{$from} LEFT OUTER JOIN {$wpdb->options} ON {$wpdb->options}.option_name = CONCAT(‘{$table_name}_’, {$primary_key}) LEFT OUTER JOIN {$wpdb->postmeta} ON {$wpdb->postmeta}.post_id = {$wpdb->options}.option_value “, $sql);

    $sql = str_replace($from, “{$from} LEFT OUTER JOIN {$wpdb->options} ON {$wpdb->options}.option_name = CONCAT(‘{$table_name}_’, {$primary_key})”, $sql);

    I only show the last 20 galleries when adding pictues to a gallery.
    Therefore also showing only the last 20 galleries in selectbox by Posts.

    Hi,

    Here also problems with performace..
    Slow querie shows:
    # Time: 140123 13:46:17
    # User@Host: @ localhost []
    # Query_time: 33.742712 Lock_time: 0.000104 Rows_sent: 1406 Rows_examined: 6492984
    use xxx;
    SET timestamp=1390481177;
    SELECT wp_ngg_gallery.* , wp_options.option_value AS ‘custom_post_id’, GROUP_CONCAT(CONCAT_WS(‘@@’, meta_key, meta_value)) AS ‘extras’ FROM wp_ngg_gallery LEFT OUTER JOIN wp_options ON wp_options.option_name = CONCAT(‘wp_ngg_gallery_’, wp_ngg_gallery.gid) LEFT OUTER JOIN wp_postmeta ON wp_postmeta.post_id = wp_options.option_value GROUP BY wp_ngg_gallery.gid;

    How can we avoid this?

    This querie is executed when trying to add gallery / images…

    Niels

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