PostBOUND 0.19.0__py3-none-any.whl

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.
Files changed (67) hide show
  1. postbound/__init__.py +211 -0
  2. postbound/_base.py +6 -0
  3. postbound/_bench.py +1012 -0
  4. postbound/_core.py +1153 -0
  5. postbound/_hints.py +1373 -0
  6. postbound/_jointree.py +1079 -0
  7. postbound/_pipelines.py +1121 -0
  8. postbound/_qep.py +1986 -0
  9. postbound/_stages.py +876 -0
  10. postbound/_validation.py +734 -0
  11. postbound/db/__init__.py +72 -0
  12. postbound/db/_db.py +2348 -0
  13. postbound/db/_duckdb.py +785 -0
  14. postbound/db/mysql.py +1195 -0
  15. postbound/db/postgres.py +4216 -0
  16. postbound/experiments/__init__.py +12 -0
  17. postbound/experiments/analysis.py +674 -0
  18. postbound/experiments/benchmarking.py +54 -0
  19. postbound/experiments/ceb.py +877 -0
  20. postbound/experiments/interactive.py +105 -0
  21. postbound/experiments/querygen.py +334 -0
  22. postbound/experiments/workloads.py +980 -0
  23. postbound/optimizer/__init__.py +92 -0
  24. postbound/optimizer/__init__.pyi +73 -0
  25. postbound/optimizer/_cardinalities.py +369 -0
  26. postbound/optimizer/_joingraph.py +1150 -0
  27. postbound/optimizer/dynprog.py +1825 -0
  28. postbound/optimizer/enumeration.py +432 -0
  29. postbound/optimizer/native.py +539 -0
  30. postbound/optimizer/noopt.py +54 -0
  31. postbound/optimizer/presets.py +147 -0
  32. postbound/optimizer/randomized.py +650 -0
  33. postbound/optimizer/tonic.py +1479 -0
  34. postbound/optimizer/ues.py +1607 -0
  35. postbound/qal/__init__.py +343 -0
  36. postbound/qal/_qal.py +9678 -0
  37. postbound/qal/formatter.py +1089 -0
  38. postbound/qal/parser.py +2344 -0
  39. postbound/qal/relalg.py +4257 -0
  40. postbound/qal/transform.py +2184 -0
  41. postbound/shortcuts.py +70 -0
  42. postbound/util/__init__.py +46 -0
  43. postbound/util/_errors.py +33 -0
  44. postbound/util/collections.py +490 -0
  45. postbound/util/dataframe.py +71 -0
  46. postbound/util/dicts.py +330 -0
  47. postbound/util/jsonize.py +68 -0
  48. postbound/util/logging.py +106 -0
  49. postbound/util/misc.py +168 -0
  50. postbound/util/networkx.py +401 -0
  51. postbound/util/numbers.py +438 -0
  52. postbound/util/proc.py +107 -0
  53. postbound/util/stats.py +37 -0
  54. postbound/util/system.py +48 -0
  55. postbound/util/typing.py +35 -0
  56. postbound/vis/__init__.py +5 -0
  57. postbound/vis/fdl.py +69 -0
  58. postbound/vis/graphs.py +48 -0
  59. postbound/vis/optimizer.py +538 -0
  60. postbound/vis/plots.py +84 -0
  61. postbound/vis/tonic.py +70 -0
  62. postbound/vis/trees.py +105 -0
  63. postbound-0.19.0.dist-info/METADATA +355 -0
  64. postbound-0.19.0.dist-info/RECORD +67 -0
  65. postbound-0.19.0.dist-info/WHEEL +5 -0
  66. postbound-0.19.0.dist-info/licenses/LICENSE.txt +202 -0
  67. postbound-0.19.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,72 @@
1
+ """The `db` module provides tools to interact with various database instances.
2
+
3
+ Generally speaking, the interactions are bidirectional: on the one hand, common database concepts like retrieving statistical
4
+ information, introspecting the logical schema or obtaining physical query execution plans are enabled through abstract
5
+ interfaces and can be used by the optimizer modules. On the other hand, the `db` modules provides tools to enforce optimization
6
+ decisions made as part of an optimization pipeline or other modules when executing the query on the actual database system.
7
+
8
+ Recall that PostBOUND does not interact with the query optimizer directly and instead relies on system-specific hints or other
9
+ special properties of the target database system to influence the optimizer behaviour. Therefore, the optimization process
10
+ usually terminates with transforming the original input query to a logically equivalent query that at the same time contains
11
+ the necessary modifications for optimization.
12
+
13
+ The central entrypoint to all database interaction is the abstract `Database` class. This class is inherited by all supported
14
+ database systems (currently PostgreSQL and MySQL). Each `Database` instace provides some basic functionality on its own (such
15
+ as the ability to execute queries), but delegates most of the work to specific and tailored interfaces. For example, the
16
+ `DatabaseSchema` models all access to the logical schema of a database and the `OptimizerInterface` encapsulates the
17
+ functionality to retrieve cost estimates or phyiscal query execution plans. All of these interfaces are once again abstract and
18
+ implemented according to the specifics of the actual database system.
19
+
20
+ Take a look at the individual interfaces for further information about their functionality and intended usage.
21
+
22
+ This module provide direct access to the Postgres interface along with a shortcut method to retrieve the current database
23
+ (aptly called `current_database`). In the background, this method delegates to the `DatabasePool`.
24
+ If you want to use the MySQL interface, make sure to install PostBOUND with MySQL support enabled and import `mysql` from
25
+ the `db` package.
26
+ """
27
+
28
+ from __future__ import annotations
29
+
30
+ from ._db import (
31
+ Connection,
32
+ Cursor,
33
+ DatabasePool,
34
+ DatabaseSchema,
35
+ DatabaseServerError,
36
+ DatabaseStatistics,
37
+ DatabaseUserError,
38
+ ForeignKeyRef,
39
+ HintService,
40
+ HintWarning,
41
+ OptimizerInterface,
42
+ PrewarmingSupport,
43
+ QueryCacheWarning,
44
+ StopwatchSupport,
45
+ TimeoutSupport,
46
+ UnsupportedDatabaseFeatureError,
47
+ current_database,
48
+ simplify_result_set,
49
+ )
50
+
51
+ __all__ = [
52
+ "postgres",
53
+ "duckdb",
54
+ "Cursor",
55
+ "Connection",
56
+ "PrewarmingSupport",
57
+ "TimeoutSupport",
58
+ "StopwatchSupport",
59
+ "QueryCacheWarning",
60
+ "ForeignKeyRef",
61
+ "DatabaseSchema",
62
+ "DatabaseStatistics",
63
+ "HintWarning",
64
+ "HintService",
65
+ "OptimizerInterface",
66
+ "DatabasePool",
67
+ "UnsupportedDatabaseFeatureError",
68
+ "DatabaseServerError",
69
+ "DatabaseUserError",
70
+ "current_database",
71
+ "simplify_result_set",
72
+ ]