-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: add support for ANALYZE <tablename>
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.
- Loading branch information
Showing
8 changed files
with
108 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2020 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package tree | ||
|
||
// Analyze represents an ANALYZE statement. | ||
type Analyze struct { | ||
Table TableExpr | ||
} | ||
|
||
// Format implements the NodeFormatter interface. | ||
func (node *Analyze) Format(ctx *FmtCtx) { | ||
ctx.WriteString("ANALYZE ") | ||
ctx.FormatNode(node.Table) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters