Skip to content

Commit bd41528

Browse files
committed
en chatgpt fix
1 parent e1bf528 commit bd41528

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

ydb/docs/en/core/concepts/datamodel/view.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Queries are executed in 2 steps:
3535
1. compilation,
3636
2. execution of the compiled code.
3737

38-
The resultant compiled code contains no evidence that the query was made using views, because all the references to views should have been replaced during compilation by the queries that they represent. It practice it means that there must be no difference in the execution time of the compiled code (step №2) for queries made using views vs. queries directly reading from the underlying tables.
38+
The resultant compiled code contains no evidence that the query was made using views, because all the references to views should have been replaced during compilation by the queries that they represent. In practice, it means that there must be no difference in the execution time of the compiled code (step №2) for queries made using views vs. queries directly reading from the underlying tables.
3939

4040
However, users might notice a little increase in the compilation time of the queries made using views compared to the compilation time of the same queries written directly. It happens due to the fact that a statement reading from a view:
4141
```sql
@@ -61,7 +61,7 @@ compilation results will be cached on the {{ ydb-short-name }} server and you wi
6161
```sql
6262
SELECT 1;
6363
```
64-
compilation can take up to a hundred times more CPU time than the execution. The cache entry is searched by the text of the query and some additional info such as a user SID.
64+
compilation can take up to a hundred times more CPU time than the execution. The cache entry is searched by the text of the query and some additional information such as a user SID.
6565

6666
The cache is updated by {{ ydb-short-name }} automatically to stay on track with the changes made to the objects that the query references. However, in the case of views the cache is not updated in the same transaction in which the object's definition changes. It happens with a little delay.
6767

ydb/docs/en/core/yql/reference/yql-core/syntax/alter_view.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
ALTER VIEW — change the definition of a view.
44

5-
This feature is not supported yet. You can redefine a view like this:
5+
This feature is not supported yet. You can redefine a view by dropping it and recreating it with a different query or options values:
66
```sql
7-
DROP VIEW redifined_view;
8-
CREATE VIEW redifined_view ...;
7+
DROP VIEW redefined_view;
8+
CREATE VIEW redefined_view ...;
99
```
1010

1111
## See also

ydb/docs/en/core/yql/reference/yql-core/syntax/create_view.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,17 @@ This option causes the underlying base relations to be checked against the privi
3333

3434
`security_invoker` option must be always set to true, because the default behavior for views is to execute the query on behalf of the view's creator, which is not supported yet.
3535

36-
The execution context of the view's query is different from the enclosing context of the SELECT from the view statement. It does not "see" previously defined PRAGMAs like TablePathPrefix, named expressions, etc. Most importantly, users must specify the tables (or views) they select from in the view's query by their schema-qualified names. You can see in the [examples](#examples) that the absolute path like `/domain/database/path/to/underlying_table` is used to specify the table, from which the view selects. We are going to change the context of the view's query compilation in the next releases.
36+
The execution context of the view's query is different from the context of the enclosing SELECT from the view statement. It does not "see" previously defined PRAGMAs like TablePathPrefix, named expressions, etc. Most importantly, users must specify the tables (or views) they select from in the view's query by their schema-qualified names. You can see in the [examples](#examples) that the absolute path like `/domain/database/path/to/underlying_table` is used to specify the table, from which a view selects. The particular context of the view's query compilation might change in next releases.
3737

38-
The only way to specify the columns you want to see in the view is to select them in particular in the view's query. Star (\*) expansions in the view's query happens each time you recompile it. The columns returned by the following statement:
38+
If you wish to specify column names that you would like to see in the output of the view, you might do so by modifying the view's query:
39+
```sql
40+
CREATE VIEW view_with_a_renamed_column WITH (security_invoker = TRUE) AS
41+
SELECT
42+
original_column_name AS custom_column_name
43+
FROM `/domain/database/path/to/underlying_table`;
44+
```
45+
46+
Star (`*`) expansion in the view's query happens each time you read from the view. The list of columns returned by the following statement:
3947
```sql
4048
/*
4149
CREATE VIEW view_with_a_star WITH (security_invoker = TRUE) AS
@@ -46,7 +54,7 @@ CREATE VIEW view_with_a_star WITH (security_invoker = TRUE) AS
4654

4755
SELECT * FROM view_with_a_star;
4856
```
49-
might change if the columns list of the `underlying_table` changes.
57+
will change if the list of columns of the `underlying_table` is altered.
5058

5159
## Examples {#examples}
5260

0 commit comments

Comments
 (0)