Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/en_US/images/statistics_definition.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/en_US/images/statistics_general.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/en_US/images/statistics_sql.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/en_US/managing_database_objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ node, and select *Create Cast...*
publication_dialog
schema_dialog
sequence_dialog
statistics_dialog
subscription_dialog
synonym_dialog
trigger_function_dialog
Expand Down
1 change: 1 addition & 0 deletions docs/en_US/release_notes_9_16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ New features
| `Issue #9626 <https://github.com/pgadmin-org/pgadmin4/issues/9626>`_ - Add support for the TOAST tuple target storage parameter in the Materialized View dialog.
| `Issue #9646 <https://github.com/pgadmin-org/pgadmin4/issues/9646>`_ - Make the init container security context in the Helm chart configurable via containerSecurityContext, consistent with the main container.
| `Issue #9699 <https://github.com/pgadmin-org/pgadmin4/issues/9699>`_ - Add support for closing a tab with a middle-click on its title.
| `Issue #2018 <https://github.com/pgadmin-org/pgadmin4/issues/2018>`_ - Added support for Extended Statistics objects (CREATE STATISTICS) under the Schema node, with full create, edit, delete, and SQL-generation support for column-based and expression-based statistics on PostgreSQL 14+.

Housekeeping
************
Expand Down
75 changes: 75 additions & 0 deletions docs/en_US/statistics_dialog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
.. _statistics_dialog:

**************************
`Statistics Dialog`:index:
**************************

Use the *Statistics* dialog to define extended statistics on one or more columns
(or expressions) of a table. Extended statistics let PostgreSQL collect
correlation data across columns that can significantly improve query-plan
estimates for queries that filter or group by multiple columns.

Extended statistics require PostgreSQL 14 or later.

The *Statistics* dialog organizes options across the *General* and *Definition*
tabs. The *SQL* tab displays the SQL command generated by your selections.

.. image:: images/statistics_general.png
:alt: Statistics dialog general tab
:align: center

Use the fields in the *General* tab to identify the statistics object:

* Use the *Name* field to enter a descriptive name. On PostgreSQL 16 and later,
the name is optional — PostgreSQL will auto-generate one if left blank.
* Use the *Owner* field to select the role that will own the statistics object.
* Use the *Schema* field to select the schema in which the statistics object
will reside.
* Use the *Comment* field to store an optional note about the statistics object.

Click the *Definition* tab to continue.

.. image:: images/statistics_definition.png
:alt: Statistics dialog definition tab
:align: center

Use the fields in the *Definition* tab to describe the statistics:

* Use the *Table* field to select the table on which the statistics will be
collected. The list is filtered to tables in the selected schema.
* Use the *Columns* field to select two or more columns. Hold *Ctrl* (or *Cmd*
on macOS) to select multiple columns. At least two columns are required when
collecting column-based statistics.
* Use the *Expressions* field to enter one or more SQL expressions separated by
commas (e.g. ``lower(col1), (col1 + col2)``). Specify expressions instead of
columns when you want statistics on derived values.
* Use the *Statistics types* field to choose which kinds of extended statistics
to collect:

* *N-distinct* — estimates the number of distinct value combinations across
the selected columns or expressions.
* *Dependencies* — detects functional dependencies between columns, improving
estimates for queries with correlated ``WHERE`` clauses.
* *MCV (Most Common Values)* — records the most common combinations of values,
available on PostgreSQL 12 and later.

Click the *SQL* tab to continue.


Your entries in the *Statistics* dialog generate a SQL command (see an example
below). Use the *SQL* tab for review; revisit or switch tabs to make any changes.

Example
*******

The following is an example of the SQL command generated by user selections in
the *Statistics* dialog:

.. image:: images/statistics_sql.png
:alt: Statistics dialog SQL tab
:align: center

* Click the *Info* button (i) to access online help.
* Click the *Save* button to save work.
* Click the *Close* button to exit without saving work.
* Click the *Reset* button to restore configuration parameters.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ def register(self, app, options):
from .sequences import blueprint as module
self.submodules.append(module)

from .statistics import blueprint as module
self.submodules.append(module)

from .synonyms import blueprint as module
self.submodules.append(module)

Expand Down
Loading
Loading