Skip to main content

All Questions

1 vote
1 answer
303 views

SQL Server hash match when joining to view

I have a subquery, which always return 1500 rows, because of TOP 1500 on the beginning. It gets left joined to a view, which returns 15mil rows if called outside any context. And in execution plan I'm ...
yoma's user avatar
  • 359
0 votes
0 answers
290 views

SQL Warning INSERT INTO %%bmk%%

I have warning on my execution plan: insert [#TABLE] select *, %%bmk%% from [#TABLE] <Warnings> <MemoryGrantWarning GrantWarningKind="Excessive Grant" RequestedMemory="...
PhinéMu's user avatar
2 votes
1 answer
902 views

Clustered index update, how changing the index only at different column value?

I've table, example as Id int primary key(clustered index) Name varchar(255)not null (non-clustered index) .. .. Other columns I execute stored procedur as update table1 set table1.Name=isnull(@...
KreminT's user avatar
  • 179
0 votes
0 answers
1k views

Comparing nvarchar param to varchar column is throwing off query estimates even after conversion

Jumping right in, here is the basic query I am dealing with: SELECT DISTINCT fk_PersonID FROM PhoneNumbers p INNER JOIN PersonPhones pp ON p.pk_PhoneNumberID = pp.fk_PhoneNumberID ...
xr280xr's user avatar
  • 13.1k
0 votes
1 answer
894 views

Comparing stored procedure execution plan at different queries

When I compare execution plans of stored procedures, it only does the first one. I want to compare query 3 which is the main SP but I just am not able to. Is there a way to do this in SQL Server ...
Mike Flynn's user avatar
  • 24.1k
17 votes
5 answers
2k views

Conditional UNION ALL in table function

So use case is as follows - there're some parameter, based on which I want to select data from one table or another. create table dbo.TEST1 (id int primary key, name nvarchar(128)) create table dbo....
Roman Pekar's user avatar