arteman (arteman) wrote in changelog,
arteman
arteman
changelog

[livejournal] r22692: LJSUP-13339: New admin tool to view uniq...

Committer: azateev
LJSUP-13339: New admin tool to view uniq intersection
U   trunk/cgi-bin/LJ/UniqCookie.pm
Modified: trunk/cgi-bin/LJ/UniqCookie.pm
===================================================================
--- trunk/cgi-bin/LJ/UniqCookie.pm	2012-08-17 15:02:28 UTC (rev 22691)
+++ trunk/cgi-bin/LJ/UniqCookie.pm	2012-08-17 15:41:35 UTC (rev 22692)
@@ -147,6 +147,29 @@
     return LJ::MemCache::get("uniq2uids:$uniq");
 }
 
+# straight db request instead of loading is used, because we need pure results
+# and do not need any uniqs to be cleaned
+sub get_shared_uniqs {
+    my ($uid, $threshold) = @_;
+    $uid ||= 0;
+    $threshold ||= 1;
+
+    my $dbr = LJ::get_db_reader();
+    my $rows = $dbr->selectall_arrayref(qq{
+            SELECT   m2.userid AS uid, 
+                     count(m2.uniq) AS qty
+            FROM     uniqmap m1 INNER JOIN uniqmap m2 
+            USING    (uniq)
+            WHERE    m1.userid = ? 
+            GROUP BY m2.userid
+            HAVING   qty >= ?
+            ORDER BY qty DESC
+            LIMIT    2000
+       }, { Slice => {} },$uid, $threshold);
+
+    return @$rows;
+}
+
 sub save_mapping {
     my $class = shift;
     return if $class->is_disabled;

Tags: arteman, azateev, livejournal, pm
Subscribe
  • 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