Posted by Barac in SQL Server, SQL Tips and Tricks
on Mar 11th, 2019 | 0 comments
Same as in previous posts examples Expanding Tables List Query and Expanding Columns List Query I usually do not notice this type of queries working in the background. But recently I end up working with a customer having DB with over 500K indexes, 150K tables and expanding indexes list operation can end up being slower than usual. Here is the code: SELECT i.name AS [Name], 'Server[@Name=' + quotename(CAST( serverproperty(N'Servername') AS sysname),'''') + ']' + '/Database[@Name=' + quotename(db_name(),'''') + ']' + '/Table[@Name=' +...
Posted by Barac in SQL Server, SQL Tips and Tricks
on Mar 5th, 2019 | 0 comments
Same as in previous post example Expanding Tables List Query I usually do not notice this type of queries working in the background. But recently I end up working with a customer having DB with 150K tables, some of the tables have more than 500 columns, and expanding columns list operation can end up being slower than usual. Here is the code: SELECT clmns.name AS [Name], 'Server[@Name=' + quotename(CAST( serverproperty(N'Servername') AS sysname),'''') + ']' + '/Database[@Name=' + quotename(db_name(),'''') + ']' + '/Table[@Name=' +...
Posted by Barac in SQL Server, SQL Tips and Tricks
on Mar 3rd, 2019 | 0 comments
Usually I do not even notice this query working in the background, since this operation is quite fast. But recently I end up working with a customer having DB with 150K tables, and expanding table list operation can be really slow and expensive. Here is the code: SELECT tbl.name AS [Name], SCHEMA_NAME(tbl.schema_id) AS [Schema], 'Server[@Name=' + quotename(CAST( serverproperty(N'Servername') AS sysname),'''') + ']' + '/Database[@Name=' + quotename(db_name(),'''') + ']' + '/Table[@Name=' + quotename(tbl.name,'''') + ' and @Schema=' +...