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

Docs on VIEWs #3286

Merged
merged 5 commits into from
May 22, 2024
Merged

Docs on VIEWs #3286

merged 5 commits into from
May 22, 2024

Conversation

jepett0
Copy link
Collaborator

@jepett0 jepett0 commented Mar 29, 2024

YDBDOCS-142

Docs in both English and Russian on:

  • CREATE VIEW
  • ALTER VIEW
  • DROP VIEW

commands and on the:

  • View concept in general, which specifies some limitations that the current implementation has.

@ydb-platform ydb-platform deleted a comment from github-actions bot Mar 29, 2024
@ydb-platform ydb-platform deleted a comment from github-actions bot Mar 29, 2024
@ydb-platform ydb-platform deleted a comment from github-actions bot Mar 29, 2024
@ydb-platform ydb-platform deleted a comment from github-actions bot Mar 29, 2024
@ydb-platform ydb-platform deleted a comment from github-actions bot Apr 2, 2024
@ydb-platform ydb-platform deleted a comment from github-actions bot Apr 2, 2024
@ydb-platform ydb-platform deleted a comment from github-actions bot Apr 2, 2024
@ydb-platform ydb-platform deleted a comment from github-actions bot Apr 2, 2024
@ydb-platform ydb-platform deleted a comment from github-actions bot Apr 2, 2024
@ydb-platform ydb-platform deleted a comment from github-actions bot Apr 2, 2024
Copy link

github-actions bot commented Apr 2, 2024

✅ Documentation build

Revision built successfully
Revision preview link

@jepett0 jepett0 marked this pull request as ready for review April 2, 2024 15:24
@jepett0 jepett0 requested a review from a team as a code owner April 2, 2024 15:24
ydb/docs/en/core/concepts/datamodel/_includes/index.md Outdated Show resolved Hide resolved
ydb/docs/en/core/concepts/datamodel/toc_i.yaml Outdated Show resolved Hide resolved
ydb/docs/en/core/concepts/datamodel/view.md Outdated Show resolved Hide resolved
ydb/docs/en/core/concepts/datamodel/view.md Outdated Show resolved Hide resolved
ydb/docs/en/core/concepts/datamodel/view.md Outdated Show resolved Hide resolved
ydb/docs/en/core/yql/reference/yql-core/syntax/toc_i.yaml Outdated Show resolved Hide resolved
ydb/docs/ru/core/yql/reference/yql-core/syntax/toc_i.yaml Outdated Show resolved Hide resolved

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

Copy link

✅ Documentation build

Revision built successfully
Revision preview link

@jepett0 jepett0 requested a review from blinkov April 11, 2024 13:50
ydb/docs/en/core/concepts/datamodel/view.md Outdated Show resolved Hide resolved
Comment on lines 54 to 58
### Problem statement

Imagine the following situation.

Alice continuously executes the following query:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
### Problem statement
Imagine the following situation.
Alice continuously executes the following query:
### Problem example
Let's consider the following situation. Alice repeatedly executes the following query:

Copy link
Collaborator Author

@jepett0 jepett0 May 20, 2024

Choose a reason for hiding this comment

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

It seems to me that "Problem example" is an uncommon phrase in English. I would change that to "Example of the problem".

I applied the rest of the suggestion without any changes.

```
compilation results will be cached on the {{ ydb-short-name }} server side, and you will not notice any difference in the performance of queries using views and direct queries.

## View redefinition lag
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
## View redefinition lag
## View redefinition lag
{% note warning %}
Query plans containing view definitions are currently cached. It might lead to the usage of an old query for a short while after a given view has been re-defined. This is going to be fixed in future releases. See below for a more detailed explanation.
{% endnote %}

Copy link
Collaborator Author

@jepett0 jepett0 May 20, 2024

Choose a reason for hiding this comment

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

I would like to change "query plans containing view definitions" to "execution plans of queries containing views" to emphasize the fact that there are no view definitions in the execution plans. Reads from views are rewritten to reads from underlying tables during the query execution plan preparation.

And I changed "re-defined" to just "redefined", because it seems that it is more frequent.

@@ -0,0 +1,78 @@
# Представления (VIEWs)

Представление - это способ сохранить запрос и обращаться к его результатам как к настоящей таблице. Само представление не хранит данных, кроме текста запроса. Запрос, хранящийся в представлении, выполняется при каждом чтении из него, генерируя возвращаемый результат. Любые изменения в таблицах, на которые ссылается представление, немедленно отражаются в результатах чтения из него.
Copy link
Member

Choose a reason for hiding this comment

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

а тут нет той же проблемы, как и при изменении текста запроса, что новые колонки прорастут только когда кеш скомпилированного запроса не обновится? а не «немедленно» после ALTER?

Copy link
Collaborator Author

@jepett0 jepett0 May 20, 2024

Choose a reason for hiding this comment

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

Думаю, что нет, не должно быть задержки обновления схемы после ALTER'а колонок таблицы при чтении из VIEW. Дело в том, что в кеше записаны версии схем таблиц, участвующих в запросе. Если хоть одна версия отличается от той, которую сам про себя знает DataShard, то запрос перекомпилируется.

ydb/docs/ru/core/concepts/datamodel/view.md Outdated Show resolved Hide resolved
ydb/docs/ru/core/concepts/datamodel/view.md Outdated Show resolved Hide resolved
{% endnote %}

## Инвалидация представления

Copy link
Member

Choose a reason for hiding this comment

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

досыпать warning в начало как в английской версии


Представьте себе следующую ситуацию.

Алёна постоянно выполняет следующий запрос:
Copy link
Member

Choose a reason for hiding this comment

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

а это общепринятый перевод Alice/Bob? что-то не припомню чтобы такое где-то видел

Copy link
Collaborator Author

@jepett0 jepett0 May 20, 2024

Choose a reason for hiding this comment

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

Нет, это моя фантазия. Честно говоря, не припомню, чтобы в русских примерах использовались какие-то общепринятые имена. На Википедии пишут, что иногда используются Петя и Вася, но если уж менять (я пока что не менял), то я бы выбрал Алису и Боба

@jepett0 jepett0 requested a review from a team as a code owner May 20, 2024 12:48
@jepett0 jepett0 removed the request for review from a team May 20, 2024 12:51
fomichev3000
fomichev3000 previously approved these changes May 22, 2024
Copy link
Member

@fomichev3000 fomichev3000 left a comment

Choose a reason for hiding this comment

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

В целом норм, я про какие-то вещи, которые резанули глаз написал. Я бы поправил


### Кэш результатов компиляции

{{ ydb-short-name }} кэширует результаты компиляции запросов на стороне сервера для большей скорости их выполнения. Для лёгких запросов вида `SELECT 1;` компиляция может длится в 100 раз дольше времени исполнения.
Copy link
Member

Choose a reason for hiding this comment

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

Я бы избегал фраз вида "компиляция может длится в 100 раз дольше времени исполнения". Напишите просто "компиляция может занимать значительное время по сравнению с временем выполнения запроса"

@@ -0,0 +1,79 @@
# CREATE VIEW

`CREATE VIEW` создаёт представление.
Copy link
Member

Choose a reason for hiding this comment

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

нужна ссылка на концепции, где описано представление

DROP VIEW redefined_view;
CREATE VIEW redefined_view ...;
```
Но этот запрос не будет атомарным.
Copy link
Member

Choose a reason for hiding this comment

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

я бы написал, что эффект от каждого стейтмента будет видим пользователю. То есть сначала вью пропадет, а потом появится. Но это все минорно...

@ydb-platform ydb-platform deleted a comment from github-actions bot May 22, 2024
Copy link

✅ Documentation build

Revision built successfully
Revision preview link

@blinkov blinkov enabled auto-merge (squash) May 22, 2024 09:01
@blinkov blinkov merged commit d3ca6fe into ydb-platform:main May 22, 2024
2 checks passed
MrLolthe1st pushed a commit to MrLolthe1st/ydb that referenced this pull request May 28, 2024
@niksaveliev niksaveliev mentioned this pull request May 29, 2024
This was referenced Jun 7, 2024
@niksaveliev niksaveliev mentioned this pull request Jun 17, 2024
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.

3 participants