Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Reproduction of poor SQL Server query plan choice
use master
go
IF db_id('MyTest') IS NOT NULL
BEGIN
ALTER DATABASE MyTest SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE MyTest;
END
CREATE DATABASE MyTest;
go
use MyTest;
go
CREATE TABLE dbo.GROUPS(
GroupId int NOT NULL,
GroupTypeId int NULL,
Description nvarchar(max) NULL,
CONSTRAINT PK_GROUPS PRIMARY KEY NONCLUSTERED ( GroupId )
)
GO
CREATE CLUSTERED INDEX IX_GROUPS
ON dbo.GROUPS ( GroupTypeId, GroupId )
GO
CREATE TABLE dbo.ORG_USERS(
UserId int NOT NULL,
OrgUnitId int NOT NULL,
RoleId int NOT NULL,
SourceOrgUnitId int NULL,
CONSTRAINT PK_ORG_USERS PRIMARY KEY CLUSTERED ( UserId, OrgUnitId )
)
GO
CREATE NONCLUSTERED INDEX IX_ORG_USERS_OrgUnitId_SourceOrgUnitId
ON dbo.ORG_USERS ( OrgUnitId, SourceOrgUnitId )
CREATE NONCLUSTERED INDEX IX_ORG_USERS_OULOOKUP_RoleId
ON dbo.ORG_USERS ( RoleId, OrgUnitId, UserId )
GO
UPDATE STATISTICS dbo.GROUPS(IX_GROUPS) WITH STATS_STREAM = 0x0100000002000000000000000000000080548A2800000000DD190000000000008519000000000000380200003800000004000A000000000000000000330000003803D8A13800000004000A000000000000000000DE00000007000000050F3901D6A7000059270000000000005927000000000000A54BBA3EA89E6F3A0432D03800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C7000000C700000002000000140000000208CD4000641D4600B07A4503101A400000804000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000001918000000000000211800000000000038060000000000004F0600000000000066060000000000007D060000000000009406000000000000AB06000000000000C206000000000000D906000000000000F00600000000000007070000000000001E0700000000000035070000000000004C0700000000000063070000000000007A070000000000009107000000000000A807000000000000BF07000000000000D607000000000000ED0700000000000004080000000000001B0800000000000032080000000000004908000000000000600800000000000077080000000000008E08000000000000A508000000000000BC08000000000000D308000000000000EA08000000000000010900000000000018090000000000002F0900000000000046090000000000005D0900000000000074090000000000008B09000000000000A209000000000000B909000000000000D009000000000000E709000000000000FE09000000000000150A0000000000002C0A000000000000430A0000000000005A0A000000000000710A000000000000880A0000000000009F0A000000000000B60A000000000000CD0A000000000000E40A000000000000FB0A000000000000120B000000000000290B000000000000400B000000000000570B0000000000006E0B000000000000850B0000000000009C0B000000000000B30B000000000000CA0B000000000000E10B000000000000F80B0000000000000F0C000000000000260C0000000000003D0C000000000000540C0000000000006B0C000000000000820C000000000000990C000000000000B00C000000000000C70C000000000000DE0C000000000000F50C0000000000000C0D000000000000230D0000000000003A0D000000000000510D000000000000680D0000000000007F0D000000000000960D000000000000AD0D000000000000C40D000000000000DB0D000000000000F20D000000000000090E000000000000200E000000000000370E0000000000004E0E000000000000650E0000000000007C0E000000000000930E000000000000AA0E000000000000C10E000000000000D80E000000000000EF0E000000000000060F0000000000001D0F000000000000340F0000000000004B0F000000000000620F000000000000790F000000000000900F000000000000A70F000000000000BE0F000000000000D50F000000000000EC0F00000000000003100000000000001A10000000000000311000000000000048100000000000005F1000000000000076100000000000008D10000000000000A410000000000000BB10000000000000D210000000000000E910000000000000001100000000000017110000000000002E1100000000000045110000000000005C1100000000000073110000000000008A11000000000000A111000000000000B811000000000000CF11000000000000E611000000000000FD1100000000000014120000000000002B1200000000000042120000000000005912000000000000701200000000000087120000000000009E12000000000000B512000000000000CC12000000000000E312000000000000FA12000000000000111300000000000028130000000000003F1300000000000056130000000000006D1300000000000084130000000000009B13000000000000B213000000000000C913000000000000E013000000000000F7130000000000000E1400000000000025140000000000003C1400000000000053140000000000006A1400000000000081140000000000009814000000000000AF14000000000000C614000000000000DD14000000000000F4140000000000000B1500000000000022150000000000003915000000000000501500000000000067150000000000007E150000000000009515000000000000AC15000000000000C315000000000000DA15000000000000F11500000000000008160000000000001F1600000000000036160000000000004D1600000000000064160000000000007B160000000000009216000000000000A916000000000000C016000000000000D716000000000000EE1600000000000005170000000000001C1700000000000033170000000000004A17000000000000611700000000000078170000000000008F17000000000000A617000000000000BD17000000000000D417000000000000EB1700000000000002180000000000001000140000004040000000000000803F0100000004000010001400000070410000C041C54EEC3F1A000000040000100014000000E040000000000000803F25000000040000100014000000803F0000B8413333934030000000040000100014000000E04000002041000020413A000000040000100014000000C0400000A841000040404B0000000400001000140000004041000000400000803F4F000000040000100014000000E04000000041ABAAAA3F58000000040000100014000000C040000080400000803F5E000000040000100014000000074300003041ABAAEA3F6A000000040000100014000000E0400000C0400000C03F72000000040000100014000000A040000040410000C04076000000040000100014000000803F000070410000404086000000040000100014000000C04000005041ABAA8A408C000000040000100014000000C0400000F0410000C04092000000040000100014000000C040000040410000C04095000000040000100014000000A0400000F0410000C0409B000000040000100014000000803F000020410000A0409E00000004000010001400000010410000004100008040A20000000400001000140000001041000040410000C040AA000000040000100014000000C040000080400000803FAF00000004000010001400000040410000A84166668640B60000000400001000140000004842000000000000803FB70000000400001000140000008040000050410000D03FC2000000040000100014000000803F000070410000A040C700000004000010001400000048420000C0400000C040C900000004000010001400000040400000F041A38B2E40D6000000040000100014000000F841000020410000A040D9000000040000100014000000A0400000803F0000803FDD000000040000100014000000C0400000B8410000B83FFB00000004000010001400000048420000E041EFEEEE3F0E0100000400001000140000008040000000410000803F19010000040000100014000000803F0000A0410000A03F2F010000040000100014000000A040000040410000C04032010000040000100014000000A0400000C041ABAA2A4047010000040000100014000000C0400000D041ABAA8A404E0100000400001000140000000041000060415555154055010000040000100014000000A040000000000000803F5601000004000010001400000020410000E0410000604159010000040000100014000000803F0000C8410000C8405E010000040000100014000000484200005041ABAA8A40620100000400001000140000003842000000000000803F640100000400001000140000000042000000000000803F66010000040000100014000000A0400000E8410000684071010000040000100014000000704100000041000080407501000004000010001400000010410000504100005041770100000400001000140000003041000040410000404179010000040000100014000000C0400000A0415555D5407D010000040000100014000000E041000050410000504082010000040000100014000000004100005041ABAA8A40870100000400001000140000002041000000000000803F88010000040000100014000000C040000030410000B0408B010000040000100014000000D8410000F0410000A040930100000400001000140000004442000000000000803F940100000400001000140000004C42000050420000504296010000040000100014000000E841000000000000803F97010000040000100014000000A041000000000000803F980100000400001000140000005442000000000000803F9901000004000010001400000040410000C0419A9999409F010000040000100014000000A8410000504100005041A1010000040000100014000000A841000000000000803FA201000004000010001400000040400000F841C7715C40AC010000040000100014000000803F000070410000A040B001000004000010001400000048420000D84146179D3FCF0100000400001000140000008242000040400000803FD501000004000010001400000000410000C04000004040D90100000400001000140000006042000070410000F03FE401000004000010001400000000400000884100008840E9010000040000100014000000E04100005041ABAA8A40ED0100000400001000140000001041000040410000C040F10100000400001000140000008C420000B8415555F540F5010000040000100014000000B8410000E841E438CE3F1B020000040000100014000000D242000000400000803F2202000004000010001400000080400000E0405555953F2E0200000400001000140000004041000030419224C93F3B020000040000100014000000E040000000400000803F3E02000004000010001400000020410000E0400000E03F430200000400001000140000003041000000000000803F44020000040000100014000000404000005041666626404A02000004000010001400000040400000C0410000404054020000040000100014000000C04000004041000000405B020000040000100014000000E04000008040000000405E020000040000100014000000803F0000C0400000C040600200000400001000140000002041000060410000E0406302000004000010001400000010410000803F0000803F65020000040000100014000000E0400000C040000040406A020000040000100014000000204100008040000000406D0200000400001000140000002041000060413333334075020000040000100014000000A04000006041000000409102000004000010001400000080400000A0400000803F9D020000040000100014000000004100008041ABAAAA3FAC0200000400001000140000000041000000412549923FB402000004000010001400000040400000F04100004040BF020000040000100014000000004100008041ABAA2A40C702000004000010001400000040400000704100004040CD020000040000100014000000803F0000F841175D3440DA0200000400001000140000001041000040410000C040DD02000004000010001400000000410000404100004040E2020000040000100014000000984100005041ABAA0A40E902000004000010001400000050410000604100006041EB02000004000010001400000040400000104100001041ED02000004000010001400000040400000D0410000D040F202000004000010001400000060420000104100009040F50200000400001000140000002C42000000000000803FF602000004000010001400000050410000E04155559540FE020000040000100014000000C0400000E8410000E8400303000004000010001400000040410000C8410000A0400A03000004000010001400000000410000984133337340110300000400001000140000000041000030410000B03F1A0300000400001000140000000041000030410000B03F2303000004000010001400000080400000E0405555953F2C030000040000100014000000C0410000D841CDCCAC40320300000400001000140000003C42000000000000803F33030000040000100014000000F841000000000000803F34030000040000100014000000C841000000000000803F350300000400001000140000005442000000000000803F360300000400001000140000009041000070410000A0403A03000004000010001400000000410000E841ABAA9A404103000004000010001400000090420000104100009040440300000400001000140000008040000000000000803F4503000004000010001400000050420000C84155550541490300000400001000140000001C420000A0400000A0404B03000004000010001400000000410000E040000060404E030000040000100014000000A040000070410000A0405203000004000010001400000000400000D8416666E63F6403000004000010001400000048420000C041B5B4B43F7C030000040000100014000000C040000040400000803F83030000040000100014000000D04100001041000090408603000004000010001400000080410000304100003041880300000400001000140000000042000000000000803F89030000040000100014000000344200000041000000418B03000004000010001400000090410000C04100000041900300000400001000140000005041000000000000803F910300000400001000140000008042000060415555954095030000040000100014000000704100005041ABAA8A409B03000004000010001400000030410000E8410000E840A00300000400001000140000000442000000000000803FA10300000400001000140000004042000040410000C040A5030000040000100014000000803F000090418887873FBE030000040000100014000000A0400000604155559540C203000004000010001400000000420000604100006040C903000004000010001400000070410000803F0000803FD3030000040000100014000000804000000041ABAAAA3FDB03000004000010001400000090410000E0403333B33FE303000004000010001400000098410000A0405555D53FEB03000004000010001400000080400000204155555540EF030000040000100014000000803F0000D84100004040F9030000040000100014000000004200003041CDCC0C4001040000040000100014000000F0410000A0400000A040030400000400001000140000003041000040419A99993F0E0400000400001000140000002041000000000000803F0F040000040000100014000000E0400000604100006040150400000400001000140000000842000098410000184119040000040000100014000000804000003041000030411B040000040000100014000000A041000088419A995940270400000400001000140000000042000050410000D03F37040000040000100014000000C04000003041ABAAEA3F42040000040000100014000000E0410000A0400000A03F4A040000040000100014000000304100000041CDCCCC3F560400000400001000140000001041000040410000404060040000040000100014000000E040000050410000D04064040000040000100014000000C842000040400000803F6B04000004000010001400000080410000B84174D1054087040000040000100014000000A040000060415555953F9B040000040000100014000000884100003041C7719C3FA8040000040000100014000000C040000070415555D53FB20400000400001000140000008040000040400000C03FB5040000040000100014000000704200005041ABAA8A3FC60400000400001000140000008040000040400000C03FC90400000400001000140000005842000070410000F03FD30400000400001000140000000442000040410000C040D70400000400001000140000008041000000000000803FD904000004000010001400000080410000C0400000C040DB0400000400001000140000005041000000000000803FE104000004000010001400000080410000104100004040E504000004000010001400000040410000304100003041E7040000040000100014000000504100003041ABAAEA3FF104000004000010001400000010410000C0400000803FF8040000040000100014000000C04000004041ABAAAA3F02050000040000100014000000A040000040410000C03F0B05000004000010001400000040400000A0416EDB36401405000004000010001400000010410000D041ABAA8A3F33050000040000100014000000C04000004041ABAAAA3F3D0500000400001000140000000842000070410000C03F48050000040000100014000000A8410000A040000020404B050000040000100014000000E8410000E0405555154050050000040000100014000000F84100005041ABAA0A405C05000004000010001400000098410000E04055551540610500000400001000140000009841000088415555B5406605000004000010001400000018420000E040555515406A050000040000100014000000104100004040000040406D05000004000010001400000040410000004100000040740500000400001000140000009841000060410000E04077050000040000100014000000C040000090414992244080050000040000100014000000C040000080412549124088050000040000100014000000204100002041555555408E050000040000100014000000C040000040410000C03F9905000004000010001400000000410000004100000040A2050000040000100014000000803F00003041CDCC0C40AE0500000400005927000000000000, ROWCOUNT = 10099, PAGECOUNT = 121
GO
UPDATE STATISTICS dbo.GROUPS(PK_GROUPS) WITH STATS_STREAM = 0x0100000002000000000000000000000084C1497D0000000065080000000000000D08000000000000380300003800000004000A0000000000000000007C000000380200003800000004000A00000000000000000038000000070000005C491E01CCA70000032700000000000003270000000000000000803FFAFCD138FAFCD138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002F0000002F0000000200000014000000382BCE40000C1C46000000000000804070561C400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000B1050000000000009906000000000000A10600000000000078010000000000008F01000000000000A601000000000000BD01000000000000D401000000000000EB0100000000000002020000000000001902000000000000300200000000000047020000000000005E0200000000000075020000000000008C02000000000000A302000000000000BA02000000000000D102000000000000E802000000000000FF0200000000000016030000000000002D0300000000000044030000000000005B0300000000000072030000000000008903000000000000A003000000000000B703000000000000CE03000000000000E503000000000000FC0300000000000013040000000000002A04000000000000410400000000000058040000000000006F0400000000000086040000000000009D04000000000000B404000000000000CB04000000000000E204000000000000F904000000000000100500000000000027050000000000003E0500000000000055050000000000006C0500000000000083050000000000009A05000000000000100014000000803F000000000000803FE2190000040000100014000000803F0000F0410000803F231A0000040000100014000000803F00003C420000803FFF1A0000040000100014000000803F000050420000803F3B1B0000040000100014000000803F0000C4420000803F9F1B0000040000100014000000803F00007C420000803F271C0000040000100014000000803F0000F8410000803F521C0000040000100014000000803F0000F8410000803F771C0000040000100014000000803F0000DE420000803FE71C0000040000100014000000803F00007C420000803F441D0000040000100014000000803F00007C420000803F941D0000040000100014000000803F00009E420000803FE41D0000040000100014000000803F0000F8410000803F121E0000040000100014000000803F00007C420000803F521E0000040000100014000000803F00001F430000803F061F0000040000100014000000803F00007C420000803FA61F0000040000100014000000803F00003C420000803F10200000040000100014000000803F00007C420000803F81200000040000100014000000803F0080CF430000803F24220000040000100014000000803F0000F8410000803F4B220000040000100014000000803F0000BE420000803FAE220000040000100014000000803F0000FE420000803F49230000040000100014000000803F00001F430000803FE9230000040000100014000000803F0000F8410000803F12240000040000100014000000803F00007C420000803F53240000040000100014000000803F00007C420000803F4A250000040000100014000000803F00000F430000803FEF250000040000100014000000803F00C043440000803FFF280000040000100014000000803F0080FF430000803F062B0000040000100014000000803F0000FE420000803F8A2B0000040000100014000000803F00007C420000803FDC2B0000040000100014000000803F0000F8410000803FFC2B0000040000100014000000803F00007C420000803F472C0000040000100014000000803F0000BE420000803FA82C0000040000100014000000803F00809F430000803FF52D0000040000100014000000803F00007C420000803F6B2E0000040000100014000000803F0000F8410000803FB52E0000040000100014000000803F0000BE420000803F162F0000040000100014000000803F00007C420000803F7A2F0000040000100014000000803F00C017440000803FDB310000040000100014000000803F00007C420000803F23320000040000100014000000803F0080DF430000803FE4330000040000100014000000803F00005F430000803FC5340000040000100014000000803F00E09B440000803FB1390000040000100014000000803F00F032450000803FF6440000040000100014000000803F0000C8410000803F11450000040000100014000000803F000000000000803F1245000004000003000000FD23800181A700000000000000DEC140CD230000000000002F000000000000E0E7A71C3F6502211C67168A4000000000000000000000000000388A400000000000000000773BF61D58D3E13F05D302007FA700000000000000D1C140B3230000000000002F000000000000A0D0BC1C3FE3AB97931ABF3A4000000000000000000000000000003A400000000000000000DB3C5B0DF053933FAD236C017EA700000000000000C7C1409F230000000000002F000000000000E0FACC1C3F9FDDF9440DCE34400000000000000000000000000000344000000000000000002B08432D038F8D3F0327000000000000, ROWCOUNT = 10099, PAGECOUNT = 40
GO
CREATE STATISTICS stats_ORG_USERS_SourceOrgUnitId ON dbo.ORG_USERS(SourceOrgUnitId) WITH STATS_STREAM = 0x0100000001000000000000000000000034DEC8EB00000000D41A000000000000941A000000000000380200003800000004000A000000000000000000000000000700000050591901CCA700001759F400000000001759F40000000000412F593B6C9926390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C8000000C80000000100000014000000000080401759744B0000000000008040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000381800000000000020190000000000002819000000000000400600000000000057060000000000006E0600000000000085060000000000009C06000000000000B306000000000000CA06000000000000E106000000000000F8060000000000000F0700000000000026070000000000003D0700000000000054070000000000006B0700000000000082070000000000009907000000000000B007000000000000C707000000000000DE07000000000000F5070000000000000C0800000000000023080000000000003A08000000000000510800000000000068080000000000007F080000000000009608000000000000AD08000000000000C408000000000000DB08000000000000F2080000000000000909000000000000200900000000000037090000000000004E0900000000000065090000000000007C090000000000009309000000000000AA09000000000000C109000000000000D809000000000000EF09000000000000060A0000000000001D0A000000000000340A0000000000004B0A000000000000620A000000000000790A000000000000900A000000000000A70A000000000000BE0A000000000000D50A000000000000EC0A000000000000030B0000000000001A0B000000000000310B000000000000480B0000000000005F0B000000000000760B0000000000008D0B000000000000A40B000000000000BB0B000000000000D20B000000000000E90B000000000000000C000000000000170C0000000000002E0C000000000000450C0000000000005C0C000000000000730C0000000000008A0C000000000000A10C000000000000B80C000000000000CF0C000000000000E60C000000000000FD0C000000000000140D0000000000002B0D000000000000420D000000000000590D000000000000700D000000000000870D0000000000009E0D000000000000B50D000000000000CC0D000000000000E30D000000000000FA0D000000000000110E000000000000280E0000000000003F0E000000000000560E0000000000006D0E000000000000840E0000000000009B0E000000000000B20E000000000000C90E000000000000E00E000000000000F70E0000000000000E0F000000000000250F0000000000003C0F000000000000530F0000000000006A0F000000000000810F000000000000980F000000000000AF0F000000000000C60F000000000000DD0F000000000000F40F0000000000000B1000000000000022100000000000003910000000000000501000000000000067100000000000007E100000000000009510000000000000AC10000000000000C310000000000000DA10000000000000F11000000000000008110000000000001F1100000000000036110000000000004D1100000000000064110000000000007B110000000000009211000000000000A911000000000000C011000000000000D711000000000000EE1100000000000005120000000000001C1200000000000033120000000000004A12000000000000611200000000000078120000000000008F12000000000000A612000000000000BD12000000000000D412000000000000EB1200000000000002130000000000001913000000000000301300000000000047130000000000005E1300000000000075130000000000008C13000000000000A313000000000000BA13000000000000D113000000000000E813000000000000FF1300000000000016140000000000002D1400000000000044140000000000005B1400000000000072140000000000008914000000000000A014000000000000B714000000000000CE14000000000000E514000000000000FC1400000000000013150000000000002A15000000000000411500000000000058150000000000006F1500000000000086150000000000009D15000000000000B415000000000000CB15000000000000E215000000000000F915000000000000101600000000000027160000000000003E1600000000000055160000000000006C1600000000000083160000000000009A16000000000000B116000000000000C816000000000000DF16000000000000F6160000000000000D1700000000000024170000000000003B170000000000005217000000000000691700000000000080170000000000009717000000000000AE17000000000000C517000000000000DC17000000000000F3170000000000000A1800000000000021180000000000001000140000B02545000000000000803F0000000004000010001400507B0C49000000000000803FCD190000040000100014009088664900808D4374D14D411A1A0000040000100014006836DA490000E842E438CE40461A000004000010001400007E1948000AB846A7607043C91A00000400001000140000A0C9440040B3469FF42943C41B00000400001000140000F4394600CCF5463EDEAC43241C000004000010001400003666470050114500806843301C0000040000100014000080624500B48D46457AB442211D0000040000100014000060484500E0E246ECADDD423D1E00000400001000140000405B45002AA946409119433D1F000004000010001400009EAF46000C47464CE8EB43591F0000040000100014000060F64500C0A744ABAADF426A1F00000400001000140000FC0A4600E0C44600408344BC1F00000400001000140000C8BC450022D34672AC3B45C61F00000400001000140000A5074700E8DC4500E85C44D01F00000400001000140000BC0B470000FA4300007A43D31F00000400001000140000B439460002DA4600682E45E41F0000040000100014000058634600504F4500504F45E61F00000400001000140000B8C3450058D84500407744EE1F00000400001000140000F85746000EBC467DFD6B437F200000040000100014000010CC460010E645E5352C420223000004000010001400004499460000B4460000B4460423000004000010001400004E964600F8174600F81742112400000400001000140060E3D64800008040000000401424000004000010001400000AB6460030E245008024448824000004000010001400002AF84600D6824600D682468A24000004000010001400007E82460038B6460038B6468C2400000400001000140000BCC9460042BC46AB02FB45902400000400001000140000E0624500BCD14600BC5146932400000400001000140000E4CE4600A47946556DA645972400000400001000140000A88246000000000000803F982400000400001000140000863347000000000000803F9924000004000010001400000F4047000000000000803F9A24000004000010001400004F0147000000000000803F9B240000040000100014000044E3460004B5460004B5469D2400000400001000140000B28246005C9C46005C9C469F24000004000010001400000A994600B0B24600B03246A82400000400001000140000905246000000000000803FA92400000400001000140000003548000000000000803FAA240000040000100014000050B245000000000000803FAB24000004000010001400001A2448000000000000803FAC24000004000010001400009FFF47000000000000803FAE24000004000010001400007052460000F04100007041B124000004000010001400000A8346002CD246002C5246B424000004000010001400004082460072824600728246B62400000400001000140000C454460020544600205446B8240000040000100014000052834600C4EF4600D81F46BC24000004000010001400001A804600D07F4600D07F46BE240000040000100014000000D841000000000000803FBF24000004000010001400003B5947000000000000803FC02400000400001000140000183347000000000000803FC1240000040000100014000068FF46000000000000803FC22400000400001000140000C87547000000000000803FC324000004000010001400004F3B47000000000000803FC4240000040000100014000014E1460028CD460028CD46C624000004000010001400006C9C460062B6460062B646C82400000400001000140000BC1E4600C2CF4600C24F46CB2400000400001000140000D08246000000000000803FCC2400000400001000140000D01E4600B8D246AB7A0C46D02400000400001000140000A2E34600A2CF4600A2CF46D224000004000010001400000C3746000000000000803FD324000004000010001400801F9E47000000000000803FD4240000040000100014000016B646000000000000803FD524000004000010001400002A9946006A9C46006A9C46E12400000400001000140000D4824600F4824600F40246E92400000400001000140000C482460054994600549946EB2400000400001000140000E681460042824600428246ED240000040000100014008090AB47000000000000803FEE24000004000010001400C0F31B48000000000000803FEF2400000400001000140000EF2448000000000000803FF024000004000010001400C0522148000000000000803FF124000004000010001400803EB847000000000000803FF22400000400001000140000147F47000000000000803FF324000004000010001400C0A72648000000000000803FF42400000400001000140000606845000000000000803FF52400000400001000140000E49B4600BECC4600BECC46F72400000400001000140000168346001A8446001A8446F92400000400001000140000CA5547000000000000803FFA24000004000010001400006E4947000000000000803FFB24000004000010001400806F8747000000000000803FFC2400000400001000140000A68647000000000000803FFD24000004000010001400002CB046000000000000803FFE2400000400001000140000B4984600548246005482460025000004000010001400002E82460030DA450030DA4502250000040000100014000093154800EEE94600EEE9450725000004000010001400002C4346006AF9461EBEEA44192500000400001000140080E8EB4700D421469BEC9C43972500000400001000140000B7B847000000000000803F98250000040000100014000010BA4600088245EE88C142DC250000040000100014008058AB47000000000000803FDD25000004000010001400009C244600A09D4600A01D46E02500000400001000140000D8F145008EDC462FBA0A421B2900000400001000140000B1D74700782E467AD3214362290000040000100014000012AD4600A0DE46BC6F9D42BA2B00000400001000140000FC9046000000000000803FBB2B00000400001000140000142B46000C194631B926420D2D0000040000100014000008C846008028444617F5412E2D00000400001000140000A44A4700C054443333AA41742D000004000010001400C04B234800009943000099428C2D000004000010001400004A8F460000A0415555D540022E00000400001000140000769D46000084420000B041072E0000040000100014000098EA460078E4460078E446092E00000400001000140000CADD4600B4554600B455460B2E00000400001000140000F4EB46005AA146005A21460E2E0000040000100014000008854600B81F4600B81F46102E0000040000100014008055A147003EF346003EF345152E00000400001000140000614247000000000000803F162E000004000010001400005E5047000000000000803F172E00000400001000140000656B47000000000000803F182E00000400001000140000F42046000000000000803F192E00000400001000140000871D47000000000000803F1A2E0000040000100014000022D0460002E9460002E9461C2E000004000010001400000ECF46008AF646008A76461F2E00000400001000140080DA9647000000000000803F202E0000040000100014000006B847000000000000803F212E000004000010001400006DAB47000000000000803F222E00000400001000140000006842000000000000803F232E00000400001000140000900347000000000000803F242E00000400001000140000AA9F46006CD446006C5446272E00000400001000140000761D47000000000000803F282E00000400001000140000A48346000000000000803F292E00000400001000140000AD5A47000000000000803F2A2E00000400001000140000772847000000000000803F2B2E00000400001000140000D50B47000000000000803F2C2E00000400001000140000089E460030E9460030E9462E2E000004000010001400009F0247000000000000803F2F2E000004000010001400008C4E46007CE046007C6046322E00000400001000140000513747000000000000803F332E000004000010001400009AB646000000000000803F342E00000400001000140000007842000000000000803F352E00000400001000140000CD1B47000000000000803F362E00000400001000140000E4B646001CB846001CB846382E00000400001000140000CEB5460090824500900245782E000004000010001400004A9D4600489346004893467A2E00000400001000140000AC8146000000000000803F7B2E000004000010001400009CD1460020B7460020B7467D2E00000400001000140080D7BA47000000000000803F7E2E00000400001000140040634048000000000000803F7F2E0000040000100014008059ED47000000000000803F802E00000400001000140080F39347000000000000803F812E000004000010001400C0061F48000000000000803F822E0000040000100014000046B7460080D24600805246852E00000400001000140080B78647000000000000803F862E00000400001000140000C70E47009EEB46009EEB46882E0000040000100014000028B84600FED24600FE52468B2E000004000010001400802F2A48000000000000803F8C2E0000040000100014000030A64600A87F4600A87F468E2E00000400001000140000942246000000000000803F8F2E00000400001000140080E25148000000000000803F902E000004000010001400001B1647000000000000803F912E0000040000100014000076A746005CC846005CC846932E00000400001000140000F8A445000000000000803F942E00000400001000140080D32B48000000000000803F952E00000400001000140000446346000000000000803F962E000004000010001400C0E87448000000000000803F972E00000400001000140000A37E47000000000000803F982E000004000010001400001891460080AD450080AD459A2E00000400001000140000A8224600E0B84600E038469D2E000004000010001400003E9B4600BC914600BC9146A02E00000400001000140000AC8346000000000000803FA12E0000040000100014000034B84600A0C844A38BC241422F00000400001000140000DD10470052D2460052D246442F00000400001000140000318F47000000000000803F452F00000400001000140000E05147000000000000803F462F00000400001000140000357547006CEF46006C6F46492F0000040000100014008053DD48000000000000803F4A2F00000400001000140000203645000000000000803F4B2F000004000010001400008CBA4600F8D44600F8D4464D2F00000400001000140080A88647000C8546000C0546502F000004000010001400005A0747000000000000803F512F000004000010001400800E9A47000000000000803F522F00000400001000140000890747000000000000803F532F0000040000100014000050C145000000000000803F542F00000400001000140000F51F47000000000000803F552F0000040000100014000076D147000000000000803F562F0000040000100014000098AD46000000000000803F572F00000400001000140000004040000000000000803F582F00000400001000140000189F47000000000000803F592F00000400001000140020EBBA48000000000000803F5A2F00000400001000140040DB3748000000000000803F5B2F000004000010001400009806470004DC460004DC465D2F00000400001000140000D38147000000000000803F5E2F000004000010001400C0606048000000000000803F5F2F00000400001000140070D90449000000000000803F602F000004000010001400004448460032C4460032C446622F0000040000100014000014A0460000A0400000A040642F0000040000100014000000CD4500D46E4634DDC541023200000400001000140000F0F54600D8A54600D8A5451B3200000400001000140000DA38470040A34612638142F23300000400001000140000A45A4700A408465DC71A42093500000400001000140000009841000000000000803F0E3500000400001000140000BB0647000000000000803F0F35000004000010001400003C444600C6DF461EE39242DA39000004000010001400008C2B46000000000000803FDB3900000400001000140000109C46009A83464D9A38427D3C0000040000100014000057824700003C4300003C42C63C00000400001000140040CD094800FC2C468D05F041723E00000400001000140000BE1E470000124548E1BA41F63F0000040000100014000000803F00989345D7E5894109450000040000030000005FAF1D01CBA700000000008072826E41BF4FAD0200000000C8000000000000802DD3243F0000000000000000000000000000000000000000407DD1400000000000805C402CE976E16A82893F3F2D800181A700000000002078766C412E0F820200000000C7000000000000405FD0673FA45BF5B1C361AF4000000000000000000000000032D03D4100000000BEE02A419933B392A37CDC3F73DC02007FA70000000000E000746C414C40810200000000C8000000000000201C99633F00000000000000000000000000000000000000008053DC40000000000065D74088816D59F72DDE3F1759F40000000000
GO
UPDATE STATISTICS dbo.ORG_USERS(IX_ORG_USERS_OrgUnitId_SourceOrgUnitId) WITH STATS_STREAM = 0x01000000030000000000000000000000A9019AE3000000008C160000000000001C16000000000000380374003800000004000A00000000000000000042004300380220003800000004000A0000000000000000006500720038036F003800000004000A00000000000000000065007300070000004DF01801CCA700001759F400000000001759F4000000000032AB073A8984003925732138941A8633000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000A8000000A80000000300000014000000000040411759744B00000000000080400000804000008040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000005814000000000000A814000000000000B014000000000000400500000000000057050000000000006E0500000000000085050000000000009C05000000000000B305000000000000CA05000000000000E105000000000000F8050000000000000F0600000000000026060000000000003D0600000000000054060000000000006B0600000000000082060000000000009906000000000000B006000000000000C706000000000000DE06000000000000F5060000000000000C0700000000000023070000000000003A07000000000000510700000000000068070000000000007F070000000000009607000000000000AD07000000000000C407000000000000DB07000000000000F2070000000000000908000000000000200800000000000037080000000000004E0800000000000065080000000000007C080000000000009308000000000000AA08000000000000C108000000000000D808000000000000EF0800000000000006090000000000001D0900000000000034090000000000004B09000000000000620900000000000079090000000000009009000000000000A709000000000000BE09000000000000D509000000000000EC09000000000000030A0000000000001A0A000000000000310A000000000000480A0000000000005F0A000000000000760A0000000000008D0A000000000000A40A000000000000BB0A000000000000D20A000000000000E90A000000000000000B000000000000170B0000000000002E0B000000000000450B0000000000005C0B000000000000730B0000000000008A0B000000000000A10B000000000000B80B000000000000CF0B000000000000E60B000000000000FD0B000000000000140C0000000000002B0C000000000000420C000000000000590C000000000000700C000000000000870C0000000000009E0C000000000000B50C000000000000CC0C000000000000E30C000000000000FA0C000000000000110D000000000000280D0000000000003F0D000000000000560D0000000000006D0D000000000000840D0000000000009B0D000000000000B20D000000000000C90D000000000000E00D000000000000F70D0000000000000E0E000000000000250E0000000000003C0E000000000000530E0000000000006A0E000000000000810E000000000000980E000000000000AF0E000000000000C60E000000000000DD0E000000000000F40E0000000000000B0F000000000000220F000000000000390F000000000000500F000000000000670F0000000000007E0F000000000000950F000000000000AC0F000000000000C30F000000000000DA0F000000000000F10F00000000000008100000000000001F1000000000000036100000000000004D1000000000000064100000000000007B100000000000009210000000000000A910000000000000C010000000000000D710000000000000EE1000000000000005110000000000001C1100000000000033110000000000004A11000000000000611100000000000078110000000000008F11000000000000A611000000000000BD11000000000000D411000000000000EB1100000000000002120000000000001912000000000000301200000000000047120000000000005E1200000000000075120000000000008C12000000000000A312000000000000BA12000000000000D112000000000000E812000000000000FF1200000000000016130000000000002D1300000000000044130000000000005B1300000000000072130000000000008913000000000000A013000000000000B713000000000000CE13000000000000E513000000000000FC1300000000000013140000000000002A1400000000000041140000000000001000140000000040000000000000803F000000000400001000140080219D47000000000000803FCD1900000400001000140000704145001C98471BCA2A44841A00000400001000140000E06745003E0B479AC95E44B21A0000040000100014000018814500838A4752B75F435B1C00000400001000140000904B45005B5947E7A4FA423D1E0000040000100014000048854500B09C477370BB433C1F00000400001000140000B8A6450071A64700383E45591F0000040000100014000000C040009C5C47A7771945721F00000400001000140000503A4540504E4825A13C45B91F0000040000100014000000324380B1D2476B7D5945D91F00000400001000140000888C4500035A4700304D45EB1F0000040000100014000030514580D39A47278E3E45072000000400001000140000D05345800FB647E2592B452A2000000400001000140000703C4500B76447D9A93B447C2000000400001000140000000040006C60474FA3F744322200000400001000140000E02E4500FF92477AFEDF446E2200000400001000140000F02E45C07B0048C4F42E459E22000004000010001400008041450045BD475E83D444DD220000040000100014000040724500296F47AB1AFF44022300000400001000140000F7214700336747ED815E4314240000040000100014000060754580E29E47E28915459A2400000400001000140000903B458027CC4712466145BF2400000400001000140000203B4500845347DE9D6145CF2400000400001000140000F89A45006E6947D3B25B45F02400000400001000140000A0CF44006D9747EAAD524508250000040000100014000000314300446947BE65BF4430250000040000100014000000404000C45947387D17454D2500000400001000140000603A450095BA4700953A4577250000040000100014000000154380DEBD470E362445A12500000400001000140000B05B450093D54700D83D45C82500000400001000140000800C440078564700785645D925000004000010001400003054450037A34798704145F52500000400001000140000405345001068473DCF30450B260000040000100014000080544500697B47BDB653451F2600000400001000140000805245005DDB478B8F4845432600000400001000140000205445C050A448BF725445A82600000400001000140000D05445808BE7474C414845CE260000040000100014000020564500F87B47282F5445E226000004000010001400007058450098B94777F7454501270000040000100014000000803F40432D48143F5545362700000400001000140000605445000140489532464577270000040000100014000020514520DA4449BCF9514568280000040000100014000020534580F28147F7021A4584280000040000100014000000A84100F62E4700A03A45962800000400001000140000405245E052C3489B1852450E290000040000100014000040014500C37C47297502452E290000040000100014000030444540249648A237FB44CC290000040000100014000000803F00119A47B1D3FC445D2A0000040000100014000090584500AA7D472262B444AF2A0000040000100014000050524500B8C147BEF74745CF2A00000400001000140000C03B458057BF4786C0C844162B00000400001000140000803C45007D7647F4CC3B452C2B00000400001000140000F052450012794766D604454D2B00000400001000140000E0D24480E8BF47D379D744892B00000400001000140000C03B4500D6FB46A8F18A44AA2B0000040000100014000020574500C67B4700C67B44ED2B00000400001000140000A05445004ABF479E58BC443D2C0000040000100014000050554500017747EC9E31449C2C00000400001000140000D0524500008147B76D1345DF2C00000400001000140000803B458023C0475D94DF441B2D00000400001000140000B0524500F0F5467878E744332D00000400001000140000E0524500708247239FE144712D00000400001000140000103B4500DA7C4733D321458C2D00000400001000140000803B458080BD476AE79344DF2D00000400001000140000D062454042214887A53B45172E00000400001000140000005C4580DA8347AF115E452B2E00000400001000140000303B45008E7A4751FED244532E0000040000100014000000924200C72347922C3B45622E0000040000100014000080554500177D4776E3DA448A2E00000400001000140000C0494500A17F4761090D45AC2E0000040000100014000040474580FD89478AD52945C92E00000400001000140000C04645004D7E472D2B81440B2F00000400001000140000C0464500A6FE4700C04645352F00000400001000140000D05C450030FF4600202A45442F00000400001000140000803B458027834736E45C45582F0000040000100014000090534500C77447D8204E456C2F0000040000100014000040534500817647217B2B45842F00000400001000140000105145806BC24708B14845A52F00000400001000140000D05145008DBF4778483445C92F00000400001000140000905345004C7C47BE370245EB2F0000040000100014000040514580CEBE474E0639450D3000000400001000140000D05245002E7A47BD092E4525300000040000100014000090514500D4FE47B9A33D4552300000040000100014000070554500D37A476C38534566300000040000100014000060504500577947003A2645823000000400001000140000B04F4500F677479C7E2C459A300000040000100014000000803F80B42048D7B34D45CD3000000400001000140000E0524580DABF472F0A3A45F6300000040000100014000000803F006A6147395E484509310000040000100014000090564500AB84479E482345253100000400001000140000C0564500B17C4733274A453B3100000400001000140000001842005C8447AB7A304554310000040000100014000000803F80B22D48DB8246458D310000040000100014000000004000CA1448B4573045C4310000040000100014000060504500D17547D8004F45D8310000040000100014000000803F008AB247634C3845F8310000040000100014000060D74400E97F4700E9FF4419320000040000100014000000F344005C7A4766E6E4444F3200000400001000140000F00445C076414877D7EB44C7320000040000100014000000FB4400F77D4700F7FD44E8320000040000100014000040FF4400E67F471C77E3440F3300000400001000140000C0E94400267B476E838F44493300000400001000140000504D45000A7B474484B2449933000004000010001400000040410067184776923B45A7330000040000100014000020474500537447259D0B45C5330000040000100014000040ED4400E87F4770F9D144EE3300000400001000140000A0D044009D7947B9B709450C340000040000100014000090504500BE7E473BE8E844313400000400001000140000905245008B784714F318454C340000040000100014000020504500DF7847B79D3D45633400000400001000140000805045005778475D9C34457C34000004000010001400001051450054784714EE1E45973400000400001000140000904545006974479E373A45AE3400000400001000140000204745807FBF47E7AC4545D03400000400001000140000D046450082FB47A30BD144263500000400001000140000704645004D7F477B642345413500000400001000140000A04745000C7E4727561C455F35000004000010001400002051450072824798A2E144853500000400001000140000904A45008C7B4798101545A33500000400001000140000F0544500F07447DBF68B441336000004000010001400008046450074FE4727961C454D3600000400001000140000E05445008B7F4799FCAD44893600000400001000140000E04F45002E7F47002EFF44AE3600000400001000140000A0554500317B47EABD2E45C83600000400001000140000F0544500F378476B7D00452C3900000400001000140000A05645009D7F4792101245AF3900000400001000140000305445007273475565D844DC3900000400001000140000904F4500FA77473DEFBC440B3A00000400001000140000904F452052904800904F45653A0000040000100014000080B94380988547EC6C2445833A0000040000100014000000A04080F19D4780F11D45E73A0000040000100014000000964300C8B54736141945153B0000040000100014000080484500C77C479F768B445A3B0000040000100014000000524300DEB847E1433345803B0000040000100014000000803F003492475BEB1645A33B0000040000100014000020514500907E471E71BD44D43B0000040000100014000010504500047747D2A72F44343C0000040000100014000000044580ECBE479EFD0145783C00000400001000140000804E45004B7C476ADE1F44E63C0000040000100014000050514580C2B94700AEF744183D00000400001000140000500F4580B6BD4729D5C344583D0000040000100014000060E0440065BF4785D6E244903D00000400001000140000D05145802BBD4700940945C23D00000400001000140000C0DF4480B4BF47335D1945EE3D00000400001000140000A04645008ABE47550DFE442D3E00000400001000140000604D458034BF47DFE21C45593E000004000010001400007039450099BB47E4C02645803E0000040000100014000000514500D7BD474E163845A43E00000400001000140000A0524500E1B94783131145D13E00000400001000140000505145805DBF4751262145603F00000400001000140000B052458018BA4786C90D45913F00000400001000140000F0554580A1B9477F9D4E4417400000040000100014000080514500C5BD47A304B04465400000040000100014000020524580ABBF47EA5505459D4000000400001000140000F054458028BE470E762445CE4000000400001000140000B05245009DB9479A7D14455C410000040000100014000010474500ACBA47665615452B4200000400001000140000A0FA440039BD476C581F456742000004000010001400000052458094BB470CEB0E45B54200000400001000140000705345C0BB3E48501213455B43000004000010001400008047450038BA471C8725459E4300000400001000140000800E45001CC44772850545FE43000004000010001400003047458066BC4728A71E45424400000400001000140000F05445001BBB47A31308458E440000040000100014000060FB448002BE4712670D45EB4400000400001000140000000E45009D90474B1B0845114500000400001000140000000E45000000000000803F12450000040000010000006F4F4101CBA70000000000C072826E41BBB39D0200000000AE000000000000201914203F89F21ACA6BB5CF40000000000000000000000000C07CD1400000000000805C403B255D77A392BA3F1759F40000000000, ROWCOUNT = 16050171, PAGECOUNT = 67096
GO
UPDATE STATISTICS dbo.ORG_USERS(IX_ORG_USERS_OULOOKUP_RoleId) WITH STATS_STREAM = 0x01000000030000000000000000000000FF8653E300000000EC040000000000007C04000000000000380392673800000004000A00000000000000000014000000380309003800000004000A00000000000000000060000000380300003800000004000A0000000000000000005000000007000000564E1901CCA700001759F400000000001759F4000000000000000000CDCC4C3D73DC5637941A863300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000140000000300000014000000000040411759744B00000000000080400000804000008040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000006C0200000000000008030000000000001003000000000000A000000000000000B700000000000000CE00000000000000E500000000000000FC0000000000000013010000000000002A01000000000000410100000000000058010000000000006F0100000000000086010000000000009D01000000000000B401000000000000CB01000000000000E201000000000000F901000000000000100200000000000027020000000000003E0200000000000055020000000000001000140000685346000000000000803F4500000004000010001400007EE248000000000000803F6400000004000010001400007A0D47000000000000803F660000000400001000140040F0E148000000000000803F680000000400001000140080A96748000000000000803F690000000400001000140000BC1447000000000000803F6B00000004000010001400C4F2464B000000000000803F6C0000000400001000140000B1A647000000000000803F6E0000000400001000140000C04F44000000000000803F740000000400001000140000D81146000000000000803F750000000400001000140000004042000000000000803F79000000040000100014000000803F000000000000803F7A0000000400001000140040855F48000000000000803F7B00000004000010001400009AF846000000000000803F7C0000000400001000140000703945000000000000803F7D0000000400001000140000BA0547000000000000803F7E0000000400001000140000802644000000000000803F7F0000000400001000140050E39D49000000000000803F80000000040000100014000000C040000000000000803F810000000400001000140000260D47000000000000803F830000000400000200000096A61D01CBA700000000008072826E41642BAF020000000014000000000000A09999A93F00000000000000000000000000000000000000008081D1400000000000606040ABD548C8A63D563F8A0D3801BCA70000000000C083E26E41F5139F020000000014000000000000A09999A93F0000000000000000000000000000000000000000CA2D1A4100000000F9172341E2DC97130E40993F1759F40000000000, ROWCOUNT = 16050171, PAGECOUNT = 70714
GO
UPDATE STATISTICS dbo.ORG_USERS(PK_ORG_USERS) WITH STATS_STREAM = 0x01000000020000000000000000000000BF0D040D000000001F15000000000000C714000000000000380374003800000004000A00000000000000000042004300380320003800000004000A0000000000000000006500720007000000D8E91801CCA700001759F400000000001759F400000000004E4AAC3B93735037941A8633000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009D0000009D0000000200000014000000000000411759744B0000000000008040000080400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000031300000000000053130000000000005B13000000000000E804000000000000FF0400000000000016050000000000002D0500000000000044050000000000005B0500000000000072050000000000008905000000000000A005000000000000B705000000000000CE05000000000000E505000000000000FC0500000000000013060000000000002A06000000000000410600000000000058060000000000006F0600000000000086060000000000009D06000000000000B406000000000000CB06000000000000E206000000000000F906000000000000100700000000000027070000000000003E0700000000000055070000000000006C0700000000000083070000000000009A07000000000000B107000000000000C807000000000000DF07000000000000F6070000000000000D0800000000000024080000000000003B080000000000005208000000000000690800000000000080080000000000009708000000000000AE08000000000000C508000000000000DC08000000000000F3080000000000000A09000000000000210900000000000038090000000000004F0900000000000066090000000000007D090000000000009409000000000000AB09000000000000C209000000000000D909000000000000F009000000000000070A0000000000001E0A000000000000350A0000000000004C0A000000000000630A0000000000007A0A000000000000910A000000000000A80A000000000000BF0A000000000000D60A000000000000ED0A000000000000040B0000000000001B0B000000000000320B000000000000490B000000000000600B000000000000770B0000000000008E0B000000000000A50B000000000000BC0B000000000000D30B000000000000EA0B000000000000010C000000000000180C0000000000002F0C000000000000460C0000000000005D0C000000000000740C0000000000008B0C000000000000A20C000000000000B90C000000000000D00C000000000000E70C000000000000FE0C000000000000150D0000000000002C0D000000000000430D0000000000005A0D000000000000710D000000000000880D0000000000009F0D000000000000B60D000000000000CD0D000000000000E40D000000000000FB0D000000000000120E000000000000290E000000000000400E000000000000570E0000000000006E0E000000000000850E0000000000009C0E000000000000B30E000000000000CA0E000000000000E10E000000000000F80E0000000000000F0F000000000000260F0000000000003D0F000000000000540F0000000000006B0F000000000000820F000000000000990F000000000000B00F000000000000C70F000000000000DE0F000000000000F50F0000000000000C1000000000000023100000000000003A10000000000000511000000000000068100000000000007F100000000000009610000000000000AD10000000000000C410000000000000DB10000000000000F2100000000000000911000000000000201100000000000037110000000000004E1100000000000065110000000000007C110000000000009311000000000000AA11000000000000C111000000000000D811000000000000EF1100000000000006120000000000001D1200000000000034120000000000004B12000000000000621200000000000079120000000000009012000000000000A712000000000000BE12000000000000D512000000000000EC12000000000000100014000078D345000000000000803FA90000000400001000140000C8D24500FCB447F7B4474562010000040000100014000078BD4500909F471F4287432D1000000400001000140000A0B94500724F47CDF42545461000000400001000140000408D45005E2647005E26455B100000040000100014000000A041008E7247B041DA42BD120000040000100014000058D24580B5A247928454442F1300000400001000140000508A4500FC884746C02A42B01E0000040000100014000058D245809DD847C89E2243312200000400001000140000B8AC45009F76471EEE1E42123300000400001000140000D0A84500ED6447075CFF421036000004000010001400001068458093DB47A7BF984528360000040000100014000010684500B74D475D9C9545343600000400001000140000D8A8450037BE47512EA0454836000004000010001400001068458087DF47000595456136000004000010001400001068458077E5470BA19F4579360000040000100014000010684580939F47783096458B360000040000100014000010684580E4BD471CCBA8459E3600000400001000140000106845809FB847CDB29345B3360000040000100014000010684500A55547006E8E45C0360000040000100014000010684580EABB4733559645D53600000400001000140000106845C05B1448BC3F9E45F43600000400001000140000D8A84500A15547556B8E45013700000400001000140000106845000A3247666E8E450C370000040000100014000010684500FC52479AC9A845173700000400001000140000D0A84580EB3B4800569645403700000400001000140000106845803AA247803AA24551370000040000100014000010684580362148D3BA97457437000004000010001400001068450080A34755559145873700000400001000140000206845006EAD47E4289A459A370000040000100014000010684500A45547556D8E45A737000004000010001400001068450097144811629945C7370000040000100014000010684500664C47CD84A345D23700000400001000140000106845C0B82F48E5F99345F93700000400001000140000D8A845409F1B48409F9B451A3800000400001000140000D0A84580A1F2476EA58A4537380000040000100014000010684580CF89476E7F9D454638000004000010001400001068450002F0465501A0454D3800000400001000140000D0A845008C0348B92791456B3800000400001000140000D8A84500E18347BCAB8C457B380000040000100014000010684500868647B7BD99458A3800000400001000140000D0A84500DA844755B58D459A38000004000010001400001068458084864700BC9945A93800000400001000140000C8A845C06E5748D1B08C45DB3800000400001000140000C8A84580C5C9470CBB9945F13800000400001000140000D8A84500D37F476E2F9245003900000400001000140000D8A845C0D20748B9DF95451E3900000400001000140000D0A845402826481E629C4541390000040000100014000010684500D57F47923092455039000004000010001400001068450004F046AB02A045573900000400001000140000D8A84500D77F47B7319245663900000400001000140000106845006BCC47CD88A3457B3900000400001000140000D8A84500817E47279E9C45893900000400001000140000D0A84580918047BC238945993900000400001000140000106845C0192D486E439E45BD3900000400001000140000106845802B8747662E9045CD3900000400001000140000D0A84500827E47C59E9C45DB3900000400001000140000D8A845800025481CAB9245003A00000400001000140000D8A84500B9CF479A2DA645153A00000400001000140000C8A8450093804755258945253A00000400001000140000D0A845802989479ED0A845333A00000400001000140000D8A845808D824727AEA045413A000004000010001400001068458037834749F69545503A00000400001000140000D8A84500A2F246B7A58A45583A00000400001000140000D8A84500A47247DBA68A45673A00000400001000140000106845800FCD47923C9C457D3A00000400001000140000D0A845007C8A4777B793458D3A00000400001000140000D8A84500793B487623A245B33A000004000010001400001068450077C64718369745C93A00000400001000140000D8A84500D87F4749329245D83A00000400001000140000D0A84500867E473BA19C45E63A00000400001000140000D0A845003A0147003A8145EF3A00000400001000140000D8A84500ED7747D9919845FD3A00000400001000140000D0A84500897A47669E85450D3B00000400001000140000C8A845009C76470068A4451A3B0000040000100014000010684500C68D479A3997452A3B00000400001000140000D8A845009EF2466EA38A45323B0000040000100014000010684500D87F4749329245413B0000040000100014000010684580441D4880449D45623B0000040000100014000010684540F9084863648D45823B0000040000100014000058A945007A7B47817A4543633D0000040000100014000010354500C67847ACCD5842CF450000040000100014000098CF4500947D47F56630425A4F00000400001000140000C8A845008E7C476FA3B643445000000400001000140000C8A845C00830485D068045715000000400001000140000C8A845C081054844688E45905000000400001000140000D0A845802AA447BD3E8A45A45000000400001000140000D8A8450040F54600407545AD50000004000010001400001068450036794700688E45BC5000000400001000140000C8A84580F9D24714068745D65000000400001000140000D0A84500CE7F47922C9245E55000000400001000140000C02C4500CEFF46922C9245ED500000040000100014000010684500877A47559D8545FD5000000400001000140000C8A84500397947B7698E450C5100000400001000140000D0A84500E9F54755756E452E510000040000100014000010684500CF7847252D8E453D5100000400001000140000C8A84580BDC947B14B784558510000040000100014000010684500A0724792A48A45675100000400001000140000C8A845F0722249E826814509520000040000100014000010684500397947B7698E45185200000400001000140000106845405AA248CDE18145695200000400001000140000C8A84500D87B4700D87B457A5200000400001000140000C8A845002A7D47A6456E458C520000040000100014000010684500237247255D8A459B520000040000100014000010684540E84548D4769A45C55200000400001000140000D0A845807DFE478C598345E55200000400001000140000C8A8450028FF4726349745015300000400001000140000D8A84500897A47669E8545115300000400001000140000D0A84500586D47AB2A7D45215300000400001000140000C8A84580D5FD47CD608745405300000400001000140000C8A84500576D479A297D45505300000400001000140000C8A84540E20148EE518F456E5300000400001000140000C8A845006D8C4755A5794581530000040000100014000010684580DFF9476ADC89459F5300000400001000140000C8A84540A91348F2697F45C55300000400001000140000C8A845A0D39C4833EC7A45165400000400001000140000C8A84500A86E4700A86E45275400000400001000140000D8A8450024FF4700247F4548540000040000100014000010684580E6BB4733837045625400000400001000140000C8A84580941E48C7F58C45875400000400001000140000D0A84500A3BA4739E6A5459A540000040000100014000010684500696A48B5149345CE5400000400001000140000D0A84580D4874780D48745DF540000040000100014000010684500A8B447AF219845F35400000400001000140000D0A84540E83C4806958C451F55000004000010001400002068450034A3470034A345305500000400001000140000D8A84500147D47A9981443A1570000040000100014000060134500CD7747F8D82F422F6000000400001000140000C0424500E87D47F1641A4216670000040000100014000060404500197747EE347B41ED760000040000100014000008CA45002E7347C1D48142AD7A00000400001000140000D0C54580F4814746104741948F00000400001000140000288C4500DF88478AD28D41089F00000400001000140000F8C04500F0674758D37841F7AD0000040000100014000028BD45002D6F47E6360A42E5B40000040000100014000020C1450066C547CD4F5C4211BC0000040000100014000038A74580EFC247988D374292C400000400001000140000D0A8458046BE4766381845BBC400000400001000140000C0A84580C6B94751E95A4288CB00000400001000140000F0A64580B7BC47DD319442A1D000000400001000140000E8A6458060FA4700EBA645BAD000000400001000140000606F45009DBA47E9AC134344D30000040000100014000060A14400D3BF47DC6BCF42FAD6000004000010001400003057458079BD47DBB870424ADD0000040000100014000020BF4580D7BF475C58174279E70000040000100014000000BF4500C4BB471C41CD4121F600000400001000140000F02E458007BC47CFAEBE41EA050100040000100014000000BF45003ABF478EBC1742011001000400001000140000C8BD45806CB6479FBD3B42D31701000400001000140000C03C44008BC0474A16B9417C280100040000100014000020BD4500BDC4472044D94101370100040000100014000028BD458025BE47033CF041B1430100040000100014000018A445804BBF47C20F934300450100040000100014000028BD45009AB6473A68AF41AC550100040000100014000028BD4580A4B84791B901421D61010004000010001400000060418061B7471E2A5242196801000400001000140000004041000000000000803F1A68010004000001000000C5AB4101CBA70000000000C072826E41BBB39D020000000097000000000000E04212EA3EE680A19A0EAAA240000000000000000000000000C07CD1400000000000805C40124ECDBEC8B2C03F1759F40000000000, ROWCOUNT = 16050171, PAGECOUNT = 141735
GO
DECLARE @UserId INT = 71710;
DECLARE @SectionGroupTypeID INT = 819;
-- uses scan + merge join,
-- estimated cost ~75
SELECT OUL.UserId,
OUL.OrgUnitId,
OUL.SourceOrgUnitId
FROM GROUPS GI
JOIN ORG_USERS OUI
ON OUI.OrgUnitId = GI.GroupId
JOIN ORG_USERS OUL
ON GI.GroupId = OUL.OrgUnitId
WHERE GI.GroupTypeID = @SectionGroupTypeId
AND OUI.UserId = @UserId
AND OUL.SourceOrgUnitId = OUL.OrgUnitId
OPTION (MAXDOP 1);
-- uses seek and loop join
-- estimated cost ~0.024
SELECT OUL.UserId,
OUL.OrgUnitId,
OUL.SourceOrgUnitId
FROM GROUPS GI
JOIN ORG_USERS OUI
ON OUI.OrgUnitId = GI.GroupId
JOIN ORG_USERS OUL
ON GI.GroupId = OUL.OrgUnitId
WHERE GI.GroupTypeID = @SectionGroupTypeId
AND OUI.UserId = @UserId
AND OUL.SourceOrgUnitId ^ OUL.OrgUnitId = 0
OPTION (MAXDOP 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment