Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Entity Framework - Adhoc queries... Expand / Collapse
Author
Message
Posted Wednesday, February 25, 2009 4:05 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, April 14, 2014 10:01 AM
Points: 2,981, Visits: 762
Are any of ya'll using the Entity Framework to develop? I am told that it generates the SQL statements.

I am concerned that having adhoc queries in an Enterprise system, and not using Stored Procedures, is going to create performance problems, AdHoc query cache and bbad sql statements.

God Bless,
ThomasLL


Thomas LeBlanc, MCITP DBA 2005, 2008 & MCDBA 2000
http://thesmilingdba.blogspot.com/
Post #664684
Posted Wednesday, February 25, 2009 9:41 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, April 21, 2014 8:18 AM
Points: 214, Visits: 642
Yeah we're using it. I say "we", they are; the movement to a complete n-tier thanks to OOP programming via vb.net and c# has led to a complete removal of business logic in the database. Now with NHibernate and EF, the trend is starting to remove stored procedures altogether! wth?

I don't like it but we'll have to live with it, since that's what Microsoft is pushing these days. Not only does EF gen sql statements, it gen's a bunch of them to get what a simple SP could have gotten. And yes, you have to give db_datareader (and/or db_datawriter) to the login making the database calls. Moreover, the small, short, little queries that it calls - based on underlying object/impedance matching - are not complex. Therefore it has to do several of them in order to get, again, where a SP could have gotten. Go look at profiler the next time a middle-tier guy fires up a web page. Additionally, it is not capable of using the cool stuff available now in SQL 2005/2008, such as MERGE, CTE, etc. In order to get that you have to create stored procedures and manually map the attributes to EF to leverage that stuff. Finally, in order to keep a connection I have seen it wrap a SELECT statement inside of a transaction. Dumb.

So, having said all of that, seriously, I can't say yay or nay; i'm a consultant, and some clients will use, and some will not. If I had my preference though...





Lee Everest

Post #664766
Posted Thursday, February 26, 2009 7:31 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 9:17 AM
Points: 10,911, Visits: 12,554
I have not used EF yet, but have done a little with Linq to SQL which is somewhat similar, although not as robust. One of the issues with Linq to SQL is that it passes string parameters using their length so that Select * from person where first_name = 'Bob' and Select * From person where first_name = 'Steve' generate 2 query plans because it parameterizes the call and sends a varchar(3) parameter the first time and varchar(5) the second time and it may also be nvarchar so if your column is varchar you have an implicit conversion taking place as well.




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #665004
Posted Thursday, February 26, 2009 8:40 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 2:02 PM
Points: 32,834, Visits: 14,974
I haven't used it, but I've seen a bunch of presentations and I talked with the developers who built LINQ last year.

They realize they're in a 1.0 release, but they've tried to structure the SQL statements they submit to perform well. Lots of workloads from different applications were used to model what they do and for many of the queries, relatively few (inner) joins, their SQL performs well.

I think it can be good or bad, and you should proceed carefully. Run some small pilots, build things two ways, see which one might work better.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #665070
Posted Thursday, February 26, 2009 7:24 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, April 14, 2014 10:01 AM
Points: 2,981, Visits: 762
Thanks for everybody's input...

It would be nice to hear from some people using it in an enterprise system with 300+ GB databases and 2500-3000 current users on 4-way Quad core machines.

We already have to use MAXDOP=1 on some SPs now because of CXPACKETS. Also, if there is a performance issue, the DBA can make an emergency change to a SP, not .net code.

God Bless,
ThomasLL


Thomas LeBlanc, MCITP DBA 2005, 2008 & MCDBA 2000
http://thesmilingdba.blogspot.com/
Post #665452
Posted Tuesday, May 04, 2010 4:27 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, August 28, 2013 12:33 PM
Points: 108, Visits: 490
I agree with what you are all saying.

We are currently debating this here as well....

it's a tradeoff...

Engineering\Coding Vs DBA state of mind and maintainability

I'm stickin to my guns here and trying to stick to SPROC usage.


Gregory A Jackson MBA, CSM
Post #915726
Posted Tuesday, May 04, 2010 5:38 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 12:40 PM
Points: 1,662, Visits: 5,228
I have minimal experience of EF in one project, and it works just fine,
although it is not being subjected to that much workload.

I would point out though, you can use stored procs within EF for Insert/Update/Delete
operations on Entities.


MM


  • MMGrid Addin
  • MMNose Addin


  • Forum Etiquette: How to post Reporting Services problems
  • Forum Etiquette: How to post data/code on a forum to get the best help - by Jeff Moden
  • How to Post Performance Problems - by Gail Shaw

  • Post #915744
    « Prev Topic | Next Topic »

    Add to briefcase

    Permissions Expand / Collapse