Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Warning! using DefiningQuerys can be VERY SLOW!</p> <p>Here's an example:</p> <p>If this is the defining query that you create an Entity against:</p> <pre><code>Select C.CustomerID, C.FirstName, C.LastName, G.SalesCatetory From CustomerDatabase.dbo.Customers C Inner Join MarketingDatabase.dbo.CustomerCategories G on G.CustomerID = C.CustomerID </code></pre> <p>Then when you do a select against the Entity by CustomerID, the SQL trace looks something like this:</p> <pre><code>Select [Extent1].[CustomerID] as [CustomerID], [Extent1].[FirstName] as [FirstName], [Extent1].[LastName] as [LastName], [Extent1].[SalesCatetory] as [SalesCatetory] From ( Select C.CustomerID, C.FirstName, C.LastName, G.SalesCatetory From CustomerDatabase.dbo.Customers C Inner Join MarketingDatabase.dbo.CustomerCategories G on G.CustomerID = C.CustomerID ) as [Extent1] Where '123456' = [Extent1].[CustomerID] </code></pre> <p>SQL Server may run this query very slowly. I had one case, a little more complicated than the above example, where I tried the DefiningQuery text directly in a SQl Server Management Console query window by adding a where clause for the value I wanted to select for. It run in less than a second. Then I captured the SQL Trace from selecting for the same value from the Entity created for this DefiningQuery and ran the SQL Trace query in a SQL Server query window - it took 13 seconds!</p> <p>So I guess that only real way to do cross database queries is to create a veiw on the server.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload