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

Update CBO docs to list more supported statements #4340

Merged
merged 1 commit into from
Feb 11, 2019

Conversation

rmloveland
Copy link
Contributor

A bit more work to address #3998.

Summary of changes:

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rmloveland rmloveland force-pushed the 20190207-optimizer-crud-updates-and-such branch from 9c77ef6 to a3a12af Compare February 8, 2019 18:44
@rmloveland
Copy link
Contributor Author

Direct link to the changed section of the CBO page is here.

Andy, please let me know if there is:

  • anything that is incorrect?
  • anything I missed that should be here?

Copy link
Contributor

@jseldess jseldess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@andy-kimball andy-kimball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andy-kimball and @rmloveland)


v2.2/cost-based-optimizer.md, line 36 at r1 (raw file):

{% include copy-clipboard.html %}
~~~ sql
> EXPLAIN(OPT) SELECT l_shipmode, avg(l_extendedprice) from lineitem GROUP BY l_shipmode;

The default output of EXPLAIN(OPT) has changed to show much less detail. To show more verbosity, you can use EXPLAIN(OPT,VERBOSE) or EXPLAIN(OPT,TYPES). You'll need to update the sample output accordingly.


v2.2/cost-based-optimizer.md, line 61 at r1 (raw file):

~~~

In contrast, this query returns `pq: unsupported statement: *tree.Insert`, which means that it will use the legacy heuristic planner instead of the cost-based optimizer:

This is no longer true, since INSERT is now supported by the CBO.


v2.2/cost-based-optimizer.md, line 74 at r1 (raw file):

## Types of statements supported by the cost-based optimizer

The cost-based optimizer supports most SQL statements. Specifically, the following types of statements are supported:

I'd add the following to make this a more complete list:

  • All SELECT statements that do not include window functions
  • All UNION statements that do not include window functions
  • All VALUES statements that do not include window functions

Copy link
Contributor Author

@rmloveland rmloveland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andy-kimball)


v2.2/cost-based-optimizer.md, line 36 at r1 (raw file):

Previously, andy-kimball (Andy Kimball) wrote…

The default output of EXPLAIN(OPT) has changed to show much less detail. To show more verbosity, you can use EXPLAIN(OPT,VERBOSE) or EXPLAIN(OPT,TYPES). You'll need to update the sample output accordingly.

I'm moving the work of updating this EXPLAIN output to #4348 in order to get the other updates live on the site for the alpha release this afternoon.


v2.2/cost-based-optimizer.md, line 61 at r1 (raw file):
Fixed by updating that paragraph to avoid using an example since that will likely change again soon. Instead it now says

In contrast, queries that are not supported by the cost-based optimizer return errors that begin with the string pq: unsupported statement: ... or specific messages like pq: aggregates with FILTER are not supported yet. Such queries will use the legacy heuristic planner instead of the cost-based optimizer.


v2.2/cost-based-optimizer.md, line 74 at r1 (raw file):

Previously, andy-kimball (Andy Kimball) wrote…

I'd add the following to make this a more complete list:

  • All SELECT statements that do not include window functions
  • All UNION statements that do not include window functions
  • All VALUES statements that do not include window functions

Fixed by adding that information to the list - thanks Andy!

A bit more work to address #3998.

Summary of changes:

- Edit the 'Supported statements' section of the ['Cost-based
  Optimizer'][1] page as follows:

  - Add DELETE per cockroachdb/cockroach#34522

  - Add `INSERT .. ON CONFLICT` variants per cockroachdb/cockroach#33339

  - Add `SELECT`, `VALUES`, and `UNION` statements that do not include
    window functions

  - Add FILTER clause on aggregate functions per
    cockroachdb/cockroach#34077

  - Remove `experimental_optimizer_updates` cluster setting

[1]: http://www.cockroachlabs.com/docs/v2.2/cost-based-optimizer.html
@rmloveland rmloveland force-pushed the 20190207-optimizer-crud-updates-and-such branch from c5fb63b to 7fbce7b Compare February 11, 2019 17:49
@rmloveland rmloveland merged commit b10f5c5 into master Feb 11, 2019
@rmloveland rmloveland deleted the 20190207-optimizer-crud-updates-and-such branch February 11, 2019 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants