forked from LBRYCommunity/lbry-sdk
fix slow sqlite query
This commit is contained in:
parent
1d9c996217
commit
43c73b9abf
1 changed files with 4 additions and 2 deletions
|
@ -423,12 +423,14 @@ class SQLiteStorage(object):
|
||||||
if only_completed:
|
if only_completed:
|
||||||
lengths = transaction.execute(
|
lengths = transaction.execute(
|
||||||
"select b.blob_hash, b.blob_length from blob b "
|
"select b.blob_hash, b.blob_length from blob b "
|
||||||
"inner join stream_blob s ON b.blob_hash=s.blob_hash and b.status='finished'"
|
"inner join stream_blob s ON b.blob_hash=s.blob_hash and b.status='finished' and s.stream_hash=?",
|
||||||
|
(stream_hash, )
|
||||||
).fetchall()
|
).fetchall()
|
||||||
else:
|
else:
|
||||||
lengths = transaction.execute(
|
lengths = transaction.execute(
|
||||||
"select b.blob_hash, b.blob_length from blob b "
|
"select b.blob_hash, b.blob_length from blob b "
|
||||||
"inner join stream_blob s ON b.blob_hash=s.blob_hash"
|
"inner join stream_blob s ON b.blob_hash=s.blob_hash and s.stream_hash=?",
|
||||||
|
(stream_hash, )
|
||||||
).fetchall()
|
).fetchall()
|
||||||
|
|
||||||
blob_length_dict = {}
|
blob_length_dict = {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue