Search

missing_join_predicate event: behavior and description by Ana Mihalj

Closed
as Duplicate Help for as Duplicate

1
0
Sign in
to vote
Type: Bug
ID: 693321
Opened: 10/6/2011 3:51:08 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
Description of missing_join_predicate event is: "This event only occurs if both sides of the join return more than one row."

From BOL (http://msdn.microsoft.com/en-us/library/ms175146(v=SQL.110).aspx): This event is produced only if both sides of the join return more than one row.

But missing_join_predicate event is produced if one side of join returns one row; it will be produced even when both side of the join returns only one row.

So behavior or documentation isn't correct.
Details (expand)

Product Language

English

Version

SQL Server Denali CTP 3

Category

SQL Engine

Operating System

Windows Server 2008 R2 Standard

Operating System Language

English

Steps to Reproduce

-- Create XEvent session
CREATE EVENT SESSION [missing_join_predicate] ON SERVER
ADD EVENT sqlserver.missing_join_predicate(
    ACTION(sqlserver.sql_text))
ADD TARGET package0.event_file(SET filename=N'D:\MissingJoinPredicate.xel')
--Start XEvent session
ALTER EVENT SESSION [missing_join_predicate]
ON SERVER
STATE = START
GO

--run query in AdventureWorks2008R2 database
select sod.SalesOrderID, th.TransactionID
from Sales.SalesOrderDetail sod
inner join Production.TransactionHistory th
on sod.SalesOrderID=th.ReferenceOrderID
where th.ReferenceOrderID=43660


Event session missing_join_predicate collected missing_join_predicate warning, but one side of join return only 1 row (from TransactionHistory) and the other side of join return 2 rows (SalesOrderDetail).

You can also delete one row from SalesOrderDetail:
delete from Sales.SalesOrderDetail
where SalesOrderID=43660 and SalesOrderDetailID=13

If you run select again, both side of the join returns only one row but event missing_join_predicate is collected.

Actual Results

In Steps to reproduce.

Expected Results

missing_join_predicate warning isn't collected.

Platform

 

Virtualization

 
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 1/30/2012 at 1:43 PM
Dear Ana,

We're closing this as a duplicate.

Best regards,
Eric Hanson
Program Manager
SQL Server Query Processing
Posted by Microsoft on 10/16/2011 at 8:21 PM
Dear Ana,

Thanks for the suggestion. We'll change the code to ignore the number of rows and issue the warning if there is no join predicate regardless of cardinality estimate. This will appear in a future relase after SQL Server 2012. We've also updated the documentation to remove the statement that "This event only occurs if both sides of the join return more than one row."

Best regards,
Eric Hanson
Program Manager
SQL Server Query Processing
Sign in to post a workaround.