Support » Plugin: post-views » [Plugin: post-views] can you optimize plugin to reduce database query?

  • I think this plugin run sql query more than others similar plugin, but this plugin has many functions ex. latest views, views by month, year etc. it good and I love it

    But some function does not necessary and may make sql work too much ex. robot log also view and preview, I know it not same but is it similar ? do we need to show both view and preview or we need only one?

    Another thing is plugin use 3 database table


    Can plugin optimize to save all data into one or two post-metadata (1 row) ?


    $viewdata = array (
      'post_view_realtime' => array (
                       'post_id' => 2,
    	           'output_type' => 'content',
                       'year_id' => 2012,
      'post_views_history' => array (
                       'view_type' => 'normal',
                       'post_id' => 2,
    	           'post_views_today' => array (-1,0,1,0,0,0),
                       'post_views_week' => 45,
    	           'post_views_month' => 260,
                       'post_views_year' => 3560,
      'wp_post_views_summary' => array (
                       'summary' => 'normal_views',
                       'summary_type' => array (
                                          'type1' => 'normal_views',
                                          'type2' => 'robot_views',
                                          'type3' => 'all_views',

    We combine all data that use in 3 database table into 1 meta post for specific post id (1 post per meta 1 row)
    After serialize array data so plugin add all data to post meta

    add_post_meta(500, ‘post-viewsss’, $viewdata );

    Now plugin keep data only 1 row like this


    I know your plugin has features more than other plugin, some other post view plugin store only view count number in post-meta so they can view only views, lease views, most views but cannot sort like your plugin

    I also dont know how to write plugin but just need to give some suggestion that plugin should optimize for wordpress performance too, I dont want to see good plugin like this go to be crazy same some plugin ex. GD Star Rating that eat many query and use many table (GD Star run around 30-50 query while normal wp blog (single page use only 17-19 query))

    I dont’t know maybe some function need to store data in separate table, it okay but if there’re other data that can combine into 1 postmeta row or 2 or 3, I think its greater than split data and use many table + many row

    If we have only 1-2 postmeta so your plugin can huge reduce many sql query also make wordpress performance better

  • The topic ‘[Plugin: post-views] can you optimize plugin to reduce database query?’ is closed to new replies.