It happened to use LIKE clauses in order to find out the the VIEW's dependency on the base tables.
information_schema.views.view_definition LIKE %sys.tables.name%
This caused a huge performance bottle-neck since there is a string search on source code of the views.
Without checking the source code, the result of the above clause can be achieved by using the following system catalog view: VIEW_TABLE_USAGE
This has following columns
exec sp_columns VIEW_TABLE_USAGE
VIEW_CATALOG
VIEW_SCHEMA
VIEW_NAME
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
information_schema.views.view_definition LIKE %sys.tables.name%
This caused a huge performance bottle-neck since there is a string search on source code of the views.
Without checking the source code, the result of the above clause can be achieved by using the following system catalog view: VIEW_TABLE_USAGE
This has following columns
exec sp_columns VIEW_TABLE_USAGE
VIEW_CATALOG
VIEW_SCHEMA
VIEW_NAME
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
No comments:
Post a Comment