From 340b740e5caa8337b91b4f490ff60c1084931be6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 12 Oct 2021 22:44:58 +0000 Subject: index: optimize after all SQLite DB commits This covers v1 inboxes, as well. We also guard the execution since "PRAGMA optimize" was only introduced in SQLite 3.18.0 (2017-03-30) --- lib/PublicInbox/SearchIdx.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/PublicInbox/SearchIdx.pm') diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index a2ed9499..928152ec 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -793,6 +793,7 @@ sub v1_checkpoint ($$;$) { ${$sync->{max}} = $self->{batch_bytes}; $self->{mm}->{dbh}->commit; + eval { $self->{mm}->{dbh}->do('PRAGMA optimize') }; my $xdb = $self->{xdb}; if ($newest && $xdb) { my $cur = $xdb->get_metadata('last_commit'); -- cgit v1.2.3-24-ge0c7