vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r23562: LJSUP-14875: [internal] add "use index" ...

Committer: vad
LJSUP-14875: [internal] add "use index" hint to query back to query since dbs still have performance issues
U   trunk/cgi-bin/LJ/Event.pm
Modified: trunk/cgi-bin/LJ/Event.pm
===================================================================
--- trunk/cgi-bin/LJ/Event.pm	2013-01-18 09:19:36 UTC (rev 23561)
+++ trunk/cgi-bin/LJ/Event.pm	2013-01-18 12:52:37 UTC (rev 23562)
@@ -689,11 +689,14 @@
             # FIXME: journals are only on one cluster! split jidlist based on cluster
             my $jidlist = join(",", @wildcards_from);
 
+            ## Strictly specify USE INDEX(PRIMARY) hint.
+            ## Otherwise mysql query planner is acting out and query takes inexcusable amount of time.
             my $sth = $udbh->prepare(qq{
                 SELECT
                     userid, subid, is_dirty, journalid, etypeid,
                     arg1, arg2, ntypeid, createtime, expiretime, flags
                 FROM subs
+                USE INDEX(PRIMARY)
                 WHERE etypeid=? AND journalid=0 $and_enabled
                     AND userid IN ($jidlist)
             });

Tags: livejournal, pm, vad, vadvs
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments