PostBOUND 0.23.3__tar.gz → 0.23.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {postbound-0.23.3 → postbound-0.23.4}/PKG-INFO +1 -1
- {postbound-0.23.3 → postbound-0.23.4}/PostBOUND.egg-info/PKG-INFO +1 -1
- {postbound-0.23.3 → postbound-0.23.4}/postbound/postgres/_explain.py +22 -12
- {postbound-0.23.3 → postbound-0.23.4}/postbound/postgres/_pg.py +3 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/qal/_qal.py +3 -6
- {postbound-0.23.3 → postbound-0.23.4}/pyproject.toml +1 -1
- {postbound-0.23.3 → postbound-0.23.4}/LICENSE.txt +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/PostBOUND.egg-info/SOURCES.txt +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/PostBOUND.egg-info/dependency_links.txt +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/PostBOUND.egg-info/requires.txt +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/PostBOUND.egg-info/top_level.txt +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/README.md +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/__init__.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/__init__.pyi +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/_base.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/_core.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/_hints.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/_ipython.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/_pipelines.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/_qep.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/_stages.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/bench.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/db/__init__.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/db/_cache.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/db/_db.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/db/_stats.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/duckdb/__init__.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/duckdb/_duckdb.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/__init__.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/__init__.pyi +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_cardinalities.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_dynprog.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_enumeration.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_helpers.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_native.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/opt/_randomized.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/parser.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/postgres/__init__.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/postgres/_config.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/postgres/_ctl.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/qal/__init__.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/qal/_formatter.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/relalg.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/train/__init__.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/train/_train.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/transform.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/__init__.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/__init__.pyi +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/_df.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/_errors.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/collections.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/dicts.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/jsonize.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/logging.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/misc.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/num.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/nx.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/proc.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/stats.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/system.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/util/typing.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/validation.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/__init__.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/__init__.pyi +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/fdl.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/graphs.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/optimizer.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/plots.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/vis/trees.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/postbound/workloads.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/setup.cfg +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/tests/test_benchmarking.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/tests/test_core.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/tests/test_docs.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/tests/test_duckdb.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/tests/test_postgres.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/tests/test_qal.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/tests/test_relalg.py +0 -0
- {postbound-0.23.3 → postbound-0.23.4}/tests/test_util.py +0 -0
|
@@ -5,7 +5,7 @@ import warnings
|
|
|
5
5
|
from collections.abc import Sequence
|
|
6
6
|
from typing import Any, Literal, get_args, override
|
|
7
7
|
|
|
8
|
-
from .._core import Cardinality, IntermediateOperator, JoinOperator, ScanOperator, TableReference
|
|
8
|
+
from .._core import Cardinality, IntermediateOperator, JoinOperator, ScanOperator, TableReference, TimeS
|
|
9
9
|
from .._qep import QueryPlan, SortKey
|
|
10
10
|
|
|
11
11
|
PostgresExplainJoinNodes = {
|
|
@@ -344,15 +344,15 @@ class PostgresExplain:
|
|
|
344
344
|
)
|
|
345
345
|
return TableReference(self.relation_name, alias)
|
|
346
346
|
|
|
347
|
-
def as_qep(self) -> QueryPlan:
|
|
347
|
+
def as_qep(self, *, planning_time: TimeS = float("nan")) -> QueryPlan:
|
|
348
348
|
"""Transforms the postgres-specific plan to a standardized `QueryPlan` instance.
|
|
349
349
|
|
|
350
|
-
Notice that this transformation is lossy since not all information from the Postgres plan can be represented in
|
|
351
|
-
execution plan instances. Furthermore, this transformation can be problematic for complicated queries that
|
|
352
|
-
special Postgres features. Most importantly, for queries involving subqueries, special node types and parent
|
|
353
|
-
relationships can be contained in the plan, that cannot be represented by other parts of PostBOUND. If this
|
|
354
|
-
and the resulting query execution plans should be used on complex workloads, it is advisable to check the
|
|
355
|
-
before continuing.
|
|
350
|
+
Notice that this transformation is lossy since not all information from the Postgres plan can be represented in
|
|
351
|
+
query execution plan instances. Furthermore, this transformation can be problematic for complicated queries that
|
|
352
|
+
use special Postgres features. Most importantly, for queries involving subqueries, special node types and parent
|
|
353
|
+
relationships can be contained in the plan, that cannot be represented by other parts of PostBOUND. If this
|
|
354
|
+
method and the resulting query execution plans should be used on complex workloads, it is advisable to check the
|
|
355
|
+
plans twice before continuing.
|
|
356
356
|
|
|
357
357
|
Returns
|
|
358
358
|
-------
|
|
@@ -364,7 +364,12 @@ class PostgresExplain:
|
|
|
364
364
|
ValueError
|
|
365
365
|
If the node contains more than two children.
|
|
366
366
|
"""
|
|
367
|
-
|
|
367
|
+
qep = self._generate_qep()
|
|
368
|
+
|
|
369
|
+
if planning_time > 0:
|
|
370
|
+
qep.measures["planning_time"] = planning_time
|
|
371
|
+
|
|
372
|
+
return qep
|
|
368
373
|
|
|
369
374
|
def _generate_qep(self, *, card_adjustment: float = 1.0) -> QueryPlan:
|
|
370
375
|
child_nodes = []
|
|
@@ -442,6 +447,11 @@ class PostgresExplain:
|
|
|
442
447
|
subplan_target_name=subplan_name,
|
|
443
448
|
)
|
|
444
449
|
|
|
450
|
+
if not math.isnan(self.planned_workers):
|
|
451
|
+
plan.estimates["planned_workers"] = self.planned_workers
|
|
452
|
+
if not math.isnan(self.launched_workers):
|
|
453
|
+
plan.measures["launched_workers"] = self.launched_workers
|
|
454
|
+
|
|
445
455
|
return plan
|
|
446
456
|
|
|
447
457
|
def inspect(self, *, _indentation: int = 0) -> str:
|
|
@@ -551,10 +561,10 @@ class PostgresPlan:
|
|
|
551
561
|
if not (isinstance(self.explain_data, dict) and "Plan" in self.explain_data):
|
|
552
562
|
raise ValueError(f"Invalid explain data: missing 'Plan' key: {explain_data}")
|
|
553
563
|
|
|
554
|
-
self.planning_time:
|
|
555
|
-
self.execution_time:
|
|
564
|
+
self.planning_time: TimeS = self.explain_data.get("Planning Time", math.nan) / 1000
|
|
565
|
+
self.execution_time: TimeS = self.explain_data.get("Execution Time", math.nan) / 1000
|
|
556
566
|
self.query_plan = PostgresExplain(self.explain_data["Plan"])
|
|
557
|
-
self._normalized_plan = self.query_plan.as_qep()
|
|
567
|
+
self._normalized_plan = self.query_plan.as_qep(planning_time=self.planning_time)
|
|
558
568
|
|
|
559
569
|
@property
|
|
560
570
|
def root(self) -> PostgresExplain:
|
|
@@ -2361,6 +2361,9 @@ class PostgresOptimizer(OptimizerInterface):
|
|
|
2361
2361
|
plan = plan[0]
|
|
2362
2362
|
if isinstance(plan, tuple):
|
|
2363
2363
|
plan = plan[0]
|
|
2364
|
+
if isinstance(plan, list):
|
|
2365
|
+
# the actual EXPLAIN output is wrapped in another list
|
|
2366
|
+
plan = plan[0]
|
|
2364
2367
|
|
|
2365
2368
|
if not isinstance(plan, dict):
|
|
2366
2369
|
warnings.warn(f"Could not parse plan: {plan}. Expected a dictionary, but got {type(plan)}.", stacklevel=2)
|
|
@@ -3727,7 +3727,7 @@ class PredicateVisitor(ABC, Generic[VisitorResult]):
|
|
|
3727
3727
|
@overload
|
|
3728
3728
|
def as_predicate(
|
|
3729
3729
|
column: ColumnReference,
|
|
3730
|
-
operation: Literal[BinaryOperator.In, "in", "IN"],
|
|
3730
|
+
operation: Literal[BinaryOperator.In, "in", "IN", BinaryOperator.NotIn, "not in", "NOT IN"],
|
|
3731
3731
|
*arguments,
|
|
3732
3732
|
) -> InPredicate: ...
|
|
3733
3733
|
|
|
@@ -3843,12 +3843,9 @@ def as_predicate(column: ColumnReference, operation: BinaryOperator | UnaryOpera
|
|
|
3843
3843
|
as_expression(upper, allow_star=False),
|
|
3844
3844
|
),
|
|
3845
3845
|
)
|
|
3846
|
-
elif operation
|
|
3846
|
+
elif operation in (BinaryOperator.In, BinaryOperator.NotIn):
|
|
3847
3847
|
arguments = util.flatten(arguments)
|
|
3848
|
-
return InPredicate(
|
|
3849
|
-
column,
|
|
3850
|
-
[as_expression(value, allow_star=False) for value in arguments],
|
|
3851
|
-
)
|
|
3848
|
+
return InPredicate(column, [as_expression(value, allow_star=False) for value in arguments], operator=operation)
|
|
3852
3849
|
elif len(arguments) != 1:
|
|
3853
3850
|
raise ValueError("Too many arguments for binary predicate: " + str(arguments))
|
|
3854
3851
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "PostBOUND"
|
|
7
|
-
version = "0.23.
|
|
7
|
+
version = "0.23.4"
|
|
8
8
|
authors = [{ name = "Rico Bergmann", email = "rico.bergmann1@tu-dresden.de" }]
|
|
9
9
|
description = "PostBOUND is a research framework to prototype and benchmark database query optimizers"
|
|
10
10
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|