Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql, stats: support ANALYZE #49214

Closed
rytaft opened this issue May 18, 2020 · 0 comments · Fixed by #49816
Closed

sql, stats: support ANALYZE #49214

rytaft opened this issue May 18, 2020 · 0 comments · Fixed by #49816
Labels
A-spatial Spatial work that is *not* related to builtins. A-sql-optimizer SQL logical planning and optimizations. A-sql-pgcompat Semantic compatibility with PostgreSQL C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

Comments

@rytaft
Copy link
Collaborator

rytaft commented May 18, 2020

For compatibility with Postgres, we should consider adding support for ANALYZE. This would basically be syntactic sugar for a call to CREATE STATISTICS on all the tables in the database. (We could also support the syntax VACUUM ANALYZE, although the VACUUM part would be basically a no-op).

This came up because the geospatial team wants to fully support as much of the PostGIS tutorial as possible, and VACUUM ANALYZE comes up frequently.

cc @awoods187, @otan

@rytaft rytaft added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-sql-pgcompat Semantic compatibility with PostgreSQL A-sql-optimizer SQL logical planning and optimizations. A-spatial Spatial work that is *not* related to builtins. labels May 18, 2020
rytaft added a commit to rytaft/cockroach that referenced this issue Jun 2, 2020
This commit adds support for `ANALYZE <tablename>` by adding the
statement as syntactic sugar for the equivalent command
`CREATE STATISTICS "" FROM <tablename>`. This improves compatibility
with Postgres, and is needed to run the PostGIS tutorial as written.

Note that this commit does not add support for `ANALYZE` without a
table name. We can add support for that and other variants later if
needed, but it is not necessary for the PostGIS tutorial.

Fixes cockroachdb#49214

Release note (sql change): Added support for `ANALYZE <tablename>`,
which causes the database to collect statistics on the given table for
use by the optimizer. The functionality of this command is equivalent
to the existing command `CREATE STATISTICS "" FROM <tablename>`, but
it increases compatibility with Postgres by using the same syntax that
Postgres uses.
craig bot pushed a commit that referenced this issue Jun 3, 2020
49816: sql: add support for ANALYZE <tablename> r=rytaft a=rytaft

This commit adds support for `ANALYZE <tablename>` by adding the
statement as syntactic sugar for the equivalent command
`CREATE STATISTICS "" FROM <tablename>`. This improves compatibility
with Postgres, and is needed to run the PostGIS tutorial as written.

Note that this commit does not add support for `ANALYZE` without a
table name. We can add support for that and other variants later if
needed, but it is not necessary for the PostGIS tutorial.

Fixes #49214

Release note (sql change): Added support for `ANALYZE <tablename>`,
which causes the database to collect statistics on the given table for
use by the optimizer. The functionality of this command is equivalent
to the existing command `CREATE STATISTICS "" FROM <tablename>`, but
it increases compatibility with Postgres by using the same syntax that
Postgres uses.

49837: docs: enhance the contributor guide r=otan a=knz

The contributor guide only contained a URL to the wiki, and was
missing searchable keywords.

This patch adds that, as well as a link to the community slack.

Release note: None

Co-authored-by: Rebecca Taft <becca@cockroachlabs.com>
Co-authored-by: Raphael 'kena' Poss <knz@thaumogen.net>
@craig craig bot closed this as completed in 3105d70 Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-spatial Spatial work that is *not* related to builtins. A-sql-optimizer SQL logical planning and optimizations. A-sql-pgcompat Semantic compatibility with PostgreSQL C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant