about summary refs log tree commit homepage
path: root/lib/PublicInbox/Msgmap.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-03 20:03:55 +0000
committerEric Wong <e@80x24.org>2022-08-04 07:00:58 +0000
commit213e03e1f9624faa4a3a9813f1eac5035c1eb62a (patch)
tree070e38ebf61c4d1f62779f9e451cffef47442835 /lib/PublicInbox/Msgmap.pm
parent63dce18973d63837efd89225085fe144a8954bdf (diff)
downloadpublic-inbox-213e03e1f9624faa4a3a9813f1eac5035c1eb62a.tar.gz
This will be used to speed up NNTP group listings and IMAP startup
with thousands of inboxes.
Diffstat (limited to 'lib/PublicInbox/Msgmap.pm')
-rw-r--r--lib/PublicInbox/Msgmap.pm12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/PublicInbox/Msgmap.pm b/lib/PublicInbox/Msgmap.pm
index 1041cd17..cb4bb295 100644
--- a/lib/PublicInbox/Msgmap.pm
+++ b/lib/PublicInbox/Msgmap.pm
@@ -144,13 +144,17 @@ sub max {
         $sth->fetchrow_array // 0;
 }
 
-sub minmax {
-        # breaking MIN and MAX into separate queries speeds up from 250ms
-        # to around 700us with 2.7million messages.
+sub min {
         my $sth = $_[0]->{dbh}->prepare_cached('SELECT MIN(num) FROM msgmap',
                                                 undef, 1);
         $sth->execute;
-        ($sth->fetchrow_array // 0, max($_[0]));
+        $sth->fetchrow_array // 0;
+}
+
+sub minmax {
+        # breaking MIN and MAX into separate queries speeds up from 250ms
+        # to around 700us with 2.7million messages.
+        (min($_[0]), max($_[0]));
 }
 
 sub mid_delete {