@matheusbsbs / matheus-bagliano / commits / 178e015c05
Fork 0

Use column indexes in git-cvsserver where necessary.

Tonight I found a git-cvsserver instance spending a lot of time in disk IO while trying to process operations against a Git repository with >30,000 objects contained in it. Blowing away my SQLLite database and rebuilding all tables with indexes on the attributes that git-cvsserver frequently runs queries against seems to have resolved the issue quite nicely. Since the indexes shouldn't hurt performance on small repositories and always helps on larger repositories we should just always create them when creating the revision storage tables. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Shawn Pearce committed Oct 23, 2006 at 01:09 UTC 178e015c0543b581a40adbf4822f44fa592ff68b
1 file changed +13 -1
git-cvsserver.perl
+13 -1
@@ -2118,9 +2118,17 @@ sub new
2118 mode TEXT NOT NULL
2119 )
2120 ");
2121 + $self->{dbh}->do("
2122 + CREATE INDEX revision_ix1
2123 + ON revision (name,revision)
2124 + ");
2125 + $self->{dbh}->do("
2126 + CREATE INDEX revision_ix2
2127 + ON revision (name,commithash)
2128 + ");
2129 }
2130
2123 - # Construct the revision table if required
2131 + # Construct the head table if required
2132 unless ( $self->{tables}{head} )
2133 {
2134 $self->{dbh}->do("
@@ -2134,6 +2142,10 @@ sub new
2142 mode TEXT NOT NULL
2143 )
2144 ");
2145 + $self->{dbh}->do("
2146 + CREATE INDEX head_ix1
2147 + ON head (name)
2148 + ");
2149 }
2150
2151 # Construct the properties table if required