This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Create PROC [dbo].[wait_for] @seconds [bigint] AS | |
| begin | |
| declare @quit bit = 0; | |
| declare @ConpareDateTime datetime2; | |
| set @ConpareDateTime = dateadd(s, @seconds, getdate() ) | |
| while(@quit=0) | |
| begin | |
| if getdate() > @ConpareDateTime | |
| set @quit = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create PROC [dbo].[gettbldetails] @tblname [varchar](255) AS | |
| begin | |
| SELECT | |
| [Fully Entity Name] = t.full_entity_name, | |
| [Schema Name] = t.schema_name, | |
| [Entity Name] = t.entity_name, | |
| [Current Distribution Method] = t.distribution_method, | |
| [Current Distribution Column] = ISNULL(t.distribution_column, '-'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| create table [dbo].[round_robin_test1] | |
| with ( distribution = round_robin) as select * from [dbo].[lineitem_source] where 1 = 0 | |
| insert into [dbo].[round_robin_test1] | |
| select top 158 * from [dbo].[lineitem_source] -- ( just slight more than 32kb) | |
| */ | |
| --exec gettbldetails '%round_robin_test1%' | |
| SELECT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| create table [dbo].[round_robin_test1] | |
| with ( distribution = round_robin) as select * from [dbo].[lineitem_source] where 1 = 0 | |
| insert into [dbo].[round_robin_test1] | |
| select top 157 * from [dbo].[lineitem_source] | |
| */ | |
| exec gettbldetails '%round_robin_test1%' | |
| SELECT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| drop table [dbo].[round_robin_test1] | |
| create table [dbo].[round_robin_test1] | |
| with ( distribution = round_robin) as select * from [dbo].[lineitem_source] | |
| where 1 = 0 | |
| drop table [dbo].[round_robin_test1] | |
| create table [dbo].[round_robin_test1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create table test_table | |
| ( | |
| col_a int, | |
| col_b int | |
| ) with ( distribution=round_robin) | |
| declare @table_object_id bigint; | |
| select object_id, * from sys.tables where name like 'test_table' | |
| select @table_object_id = object_id from sys.tables where name like 'test_table' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- distributions | |
| select * from sys.pdw_distributions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Run against master database | |
| SELECT db.name [Database] | |
| , ds.edition [Edition] | |
| , ds.service_objective [Service Objective] | |
| FROM sys.database_service_objectives AS ds | |
| JOIN sys.databases AS db ON ds.database_id = db.database_id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Size of dedicated SQL pool | |
| SELECT DATABASEPROPERTYEX (DB_NAME(), 'ServiceObjective' ) as ServiceObjective |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --https://docs.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/sql-data-warehouse-tables-overview | |
| SELECT | |
| [Fully Entity Name] = t.full_entity_name, | |
| [Schema Name] = t.schema_name, | |
| [Entity Name] = t.entity_name, | |
| [Current Distribution Method] = t.distribution_method, | |
| [Current Distribution Column] = ISNULL(t.distribution_column, '-'), | |
| [Current Rows] = SUM(t.rows_count), | |
| [Distribution Count] = COUNT(t.rows_count), | |
| [Current Data Size on Disk MB] = SUM(t.data_size_MB), |