code-intel: pass hex byte encoded commit hash to query
Created by: Strum355
Instead of having postgres encode every rows commit_bytea to string to perform the IN
Explain for the query on a local instance (with 2 repos in lsif_nearest_uploads and ~9k rows) less representative
Nested Loop (cost=0.00..400.66 rows=42 width=74) (actual time=6.100..6.102 rows=0 loops=1)
Join Filter: (nu.upload_id = u.id)
-> Seq Scan on lsif_nearest_uploads nu (cost=0.00..393.43 rows=42 width=31) (actual time=6.098..6.098 rows=0 loops=1)
Filter: (ancestor_visible AND (repository_id = 1) AND (encode(commit_bytea, 'hex'::text) = '\x93274522faf9b3e065cb4e17b424b549aee7e1e6'::text))
Rows Removed by Filter: 9453
-> Materialize (cost=0.00..4.08 rows=5 width=16) (never executed)
-> Seq Scan on lsif_uploads u (cost=0.00..4.05 rows=5 width=16) (never executed)
pghero on dotcom shows that the query takes between 5-13seconds average