[dba-VS] [AccessD] Examples In Best Coding VB.net

Dan Waters df.waters at outlook.com
Sat Oct 22 09:50:22 CDT 2016


If you use LINQPad to view the SQL language you'll see that it's pretty good!

But then - clowns don't use LINQPad do they?

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Saturday, October 22, 2016 2:39 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Examples In Best Coding VB.net

> LINQ resolves to optimized SQL language to give you great performance.

ROTFLMAO!

Just had a website bring a shared server to its knees because of LINQ resolving to the following "optimised" SQL:

(Admittedly the developer is a bit of a clown who doesn't really understand realtional databases - He took a view from an in house server that was based on 6 related tables and dumped the output of that view as a flat table - hence the SQL is drawing data from a wide table containing 4.5million records named  [dbo].[vw_SearchElectorDetails]  )

You will note that it actually pulls the entire table as a recordset which is then used as the source of the  actual select.


SELECT       
[Extent1].[LName] AS [LName],       [Extent1].[FName] AS
[FName],       [Extent1].[Gender] AS [Gender],       [Extent1].[Address]
AS [Address],       [Extent1].[DOB] AS [DOB],       [Extent1].[ElectorPK]
AS [ElectorPK],       [Extent1].[LocationName] AS [LocationName],      
[Extent1].[WardName] AS [WardName],       [Extent1].[LLGName] AS
[LLGName],       [Extent1].[DistrictName] AS [DistrictName],      
[Extent1].[ProvinceName] AS [ProvinceName]      

FROM 
(SELECT     
[vw_SearchElectorDetails].[LName] AS [LName],     
[vw_SearchElectorDetails].[FName] AS [FName],     
[vw_SearchElectorDetails].[Gender] AS [Gender],     
[vw_SearchElectorDetails].[Address] AS [Address],     
[vw_SearchElectorDetails].[DOB] AS [DOB],     
[vw_SearchElectorDetails].[ElectorPK] AS [ElectorPK],     
[vw_SearchElectorDetails].[LocationName] AS [LocationName],     
[vw_SearchElectorDetails].[WardName] AS [WardName],     
[vw_SearchElectorDetails].[LLGName] AS [LLGName],      [vw_Search
 ElectorDetails].[DistrictName] AS [DistrictName],     
 [vw_SearchElectorDetails].[ProvinceName] AS [ProvinceName]   

  FROM
 [dbo].[vw_SearchElectorDetails] AS [vw_SearchElectorDetails]) 

AS  [Extent1]    
WHERE [Extent1].[LName] = @p__linq__0

--
Stuart

On 21 Oct 2016 at 15:46, Dan Waters wrote:

...
> I also made the choice to use LINQ as the data layer between my 
> application and SQL server.  And this is really the way to go.  It 
> gives you intellisense while you're writing code for CRUD operations 
> and you'll get error indicators on-screen if you've done something 
> wrong.  Also - buy a copy of LINQPad Pro - it's a great sandbox for 
> writing LINQ queries.  LINQ resolves to optimized SQL language to give 
> you great performance.
> 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the dba-VS mailing list