powered by simpleCommunicator - 2.0.59     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / Я в полном дроп-дауне
3 сообщений из 3, страница 1 из 1
Я в полном дроп-дауне
    #32007232
Фотография Garya
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Это не вопрос, просто попытька поделиться эмоциями.
Ну не обратил я внимания на ограничения материализованных представлениях. А теперь попробовал таковое создать - грабли! Говорит, что финкция MIN() и MAX() - во вьюхах не могут быть использованы совместно с кластерным индексоим для VIEW. И подзапросы использовать нельзя! И кучу чего другого использовать нельзя! Я когда вгляделся во все, чего еще нельзя во VIEW использовать, чтобы по нему можно было создать кластерный индекс, то просто в обморок упал! Если выполнять все перечисленные требования, то никакого VIEW вообще не напишешь! Выходит, они не для решения серьезных задач, а так, для баловства...
Вот тот трагический отрывок из BOL:

Restrictions on indexed views
The SELECT statement defining an indexed view must not have the TOP, DISTINCT, COMPUTE, HAVING, and UNION keywords. It cannot have a subquery.

The SELECT list may not include asterisks (*), 'table.*' wildcard lists, DISTINCT, COUNT(*), COUNT(<expression&gt, computed columns from the base tables, and scalar aggregates.

Nonaggregate SELECT lists cannot have expressions. Aggregate SELECT list (queries that contain GROUP BY) may include SUM and COUNT_BIG(<expression&gt; it must contain COUNT_BIG(*). Other aggregate functions (MIN, MAX, STDEV,...) are not allowed.

Complex aggregation using AVG cannot participate in the SELECT list of the indexed view. However, if a query uses such aggregation, the optimizer is capable of using this indexed view to substitute AVG with a combination of simple aggregates SUM and COUNT_BIG.

A column resulting from an expression that either evaluates to a float data type or uses float expressions for its evaluation cannot be a key of an index in an indexed view or on a computed column in a table. Such columns are called nonprecise. Use the COLUMNPROPERTY function to determine if a particular computed column or a column in a view is precise.

Indexed views are subject to these additional restrictions:

The creator of the index must own the tables. All tables, the view, and the index, must be created in the same database.


The SELECT statement defining the indexed view may not contain views, rowset functions, inline functions, or derived tables. The same physical table may occur only once in the statement.


In any joined tables, no OUTER JOIN operations are allowed.


No subqueries or CONTAINS or FREETEXT predicates are allowed in the search condition.


If the view definition contains a GROUP BY clause, all grouping columns as well as the COUNT_BIG(*) expression must appear in the view's SELECT list. Also, these columns must be the only columns in the CREATE UNIQUE CLUSTERED INDEX clause.
The body of the definition of a view that can be indexed must be deterministic and precise, similar to the requirements on indexes on computed columns.
...
Рейтинг: 0 / 0
Я в полном дроп-дауне
    #32007237
Alexander Chepack
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Ну так это обычное дело - любая новая feature в MS продуктах предназначена для любования, но никак не для реального использования - надо ждать следующей версии - может там это станет серьезнее...
...
Рейтинг: 0 / 0
Я в полном дроп-дауне
    #32007249
Фотография Александр Гладченко
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Это, как с женщиной, одно дело днём, а другое ночью…
...
Рейтинг: 0 / 0
3 сообщений из 3, страница 1 из 1
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / Я в полном дроп-дауне
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]