Results 1 to 5 of 5

Bad Query

This is a discussion on Bad Query within the Bug Reporting forums, part of the vBSEO SEO Plugin category; Bad Query on showthread.php: Code: SELECT t_id, t_time, t_src_url, t_dest_url, t_type, t_postid, t_postcount, t_threadid, t_page, t_title, t_text, t_approve FROM " ...

  1. #1
    Junior Member
    Real Name
    Andreas
    Join Date
    Jul 2007
    Posts
    27
    Liked
    0 times

    Bad Query

    Bad Query on showthread.php:

    Code:
    SELECT t_id, t_time, t_src_url, t_dest_url, t_type, t_postid, t_postcount, t_threadid, t_page, t_title, t_text, t_approve
    FROM " . vbseo_tbl_prefix('linkback') . "linkback
    WHERE t_incoming=1 AND t_deleted=0 AND " . ($ismod?'':'t_approve>0 AND ') . "t_threadid = '" . $thread['threadid'] . "' " . "ORDER BY t_time " . (preg_match('#^(asc|desc)$#i', VBSEO_DEFAULT_LINKBACKS_ORDER) ? VBSEO_DEFAULT_LINKBACKS_ORDER : "DESC")
    This is causing a filesort.
    I suggest to change the indexes to have the sortfield included.

    Also, this query gets executed even if there are no linkbacks - which is mostly the case (approx. 5% of all threads in the board I monitored do have linkbacks).

    I suggest to add a flag to thread table to avoid this query if it isn't necessary.

    Is there anything I could do to stop this query?

  2. #2
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    168 times
    Hello,

    thank you for suggestion. We try to avoid altering existing vB db tables if possible.

  3. #3
    Junior Member
    Real Name
    Andreas
    Join Date
    Jul 2007
    Posts
    27
    Liked
    0 times
    I fully understand that, but I tend to disagree

    Optimizing performance is very important, especially for Big Boards.
    And this query seems mostly useless (as the vast majority of threads does not have linkbacks).

    Thereofre I would like to disable it if there is no data.
    Last edited by KirbyDE; 02-24-2008 at 12:27 PM.

  4. #4
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    168 times
    Again, thank you for suggestion (my reply didn't mean that it will be ignored )

  5. #5
    vBSEO Staff Juan Muriente's Avatar
    Real Name
    Juan Carlos Muriente
    Join Date
    Jun 2005
    Location
    Puerto Rico
    Posts
    14,266
    Liked
    586 times
    Thank-you for bringing this up Andreas, we've added a new field in vBulletin's thread table to keep track of the number of approved incoming linkbacks, allowing us to avoid that extra sql query on showthread pages.

    Although this is a lightweight query, as you know, we are always looking for ways to improve vBSEO's performance... a bunch of marginal improvements become a substantial improvement.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •