mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-01-28 22:59:03 -06:00
Add flags to skip potentially problematic queries
This commit is contained in:
@@ -109,6 +109,16 @@ class Command(BaseCommand):
|
|||||||
default=1,
|
default=1,
|
||||||
help="How many custom field instances per document (default: 1)",
|
help="How many custom field instances per document (default: 1)",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--skip-tags",
|
||||||
|
action="store_true",
|
||||||
|
help="Skip tag document_count benchmarks (useful for large datasets on Postgres)",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--skip-custom-fields",
|
||||||
|
action="store_true",
|
||||||
|
help="Skip custom field document_count benchmarks",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--reuse-existing",
|
"--reuse-existing",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
@@ -121,6 +131,9 @@ class Command(BaseCommand):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
# keep options for downstream checks
|
||||||
|
self.options = options
|
||||||
|
|
||||||
document_total = options["documents"]
|
document_total = options["documents"]
|
||||||
owner_ratio = options["owner_ratio"]
|
owner_ratio = options["owner_ratio"]
|
||||||
unowned_ratio = options["unowned_ratio"]
|
unowned_ratio = options["unowned_ratio"]
|
||||||
@@ -457,7 +470,13 @@ class Command(BaseCommand):
|
|||||||
iterations=iterations,
|
iterations=iterations,
|
||||||
fn=lambda: Document.objects.count(),
|
fn=lambda: Document.objects.count(),
|
||||||
)
|
)
|
||||||
self._time_tag_counts(iterations=iterations, prefix=prefix, user=target_user)
|
if not self.options.get("skip_tags"):
|
||||||
|
self._time_tag_counts(
|
||||||
|
iterations=iterations,
|
||||||
|
prefix=prefix,
|
||||||
|
user=target_user,
|
||||||
|
)
|
||||||
|
if not self.options.get("skip_custom_fields"):
|
||||||
self._time_custom_field_counts(
|
self._time_custom_field_counts(
|
||||||
iterations=iterations,
|
iterations=iterations,
|
||||||
prefix=prefix,
|
prefix=prefix,
|
||||||
|
|||||||
Reference in New Issue
Block a user