X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FMsgmap.pm;h=cb4bb2956ba2e6f856596a7dffccf7d6a888b34b;hb=HEAD;hp=1041cd177ed2dbb5589228354b29a1bf0b2eccd4;hpb=14fa0abdcc7b6513540e529375e53edd74ce13e8;p=public-inbox.git 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 {