mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-10-30 19:45:44 +00:00
Handcrafts SQL queries a little more to reduce the query count and/or the amount of returned data (#6489)
This commit is contained in:
1 parent
63e1f9f5d3
commit
7be7185418
10 files changed
+188
-135
No files matched your search
@@ -131,7 +131,12 @@ def get_metadata_cache(document_id: int) -> Optional[MetadataCacheData]:
|
||||
# The metadata exists in the cache
|
||||
if doc_metadata is not None:
|
||||
try:
|
||||
doc = Document.objects.get(pk=document_id)
|
||||
doc = Document.objects.only(
|
||||
"pk",
|
||||
"checksum",
|
||||
"archive_checksum",
|
||||
"archive_filename",
|
||||
).get(pk=document_id)
|
||||
# The original checksums match
|
||||
# If it has one, the archive checksums match
|
||||
# Then, we can use the metadata
|
||||
|
||||
Reference in new issue
Block a user