Stored Procedures - End of days

前端 未结 20 1406
轻奢々
轻奢々 2021-01-31 08:51

I’m listening to the Hanselminutes Podcast; \"StackOverflow uses ASP.NET MVC - Jeff Atwood and his technical team\". During the course of the Podcast they are speaking about SQL

相关标签:
20条回答
  • 2021-01-31 09:29

    This question also bleeds into one posted earlier today.

    0 讨论(0)
  • 2021-01-31 09:29

    Bah!

    ORM, SPs, View, Magic Wands, or whatever.

    Each "tool" has its place in your belt, use the tools you have wisely.

    The only thing that has "changed" ( really improved ) is that some ORMs have nice caching tools already baked in and MySql and Sql 2005+ can handle dynamic or ad hoc query/execution plan caching.

    The potential performance loss from throwing the all sorts of dynamic sql at your db server has been somewhat mitigated. Its just easier to go without stored procedures now. Stored Procs aren't going anywhere.

    0 讨论(0)
  • 2021-01-31 09:34

    I keep hearing the argument that SPs are good if you have multiple applications connecting to the database or that it makes bug fixing easier.

    THIS IS WHAT A SERVICE LAYER IS FOR!

    Business logic goes in the service layer, application logic goes in the application/web site.

    It's alot harder to debug and maintain hundreds of SPs (especially if there generated) than it is to maintain well written code that talks to a DB via an ORM tool.

    0 讨论(0)
  • 2021-01-31 09:34

    Just throwing my little advice here. Before SQL 2005 (maybe even farther than that), SP were faster. However, SQL Server 2005 and up are really optimized and they cache your queries as you go. In fact, we had a web application transfered to a new SQL server. The application started by running slowing for everyone. Everything was taking "3/4 of a second" or 1 second to run. Then SQL started compiling the most used query and everything went from slow to blazing fast.

    Of course, we swapped the server while there was a lot of people running on it (which can explain why it was slow at first). But trust me. SP are not over. They just have other uses than being tied to an application.

    0 讨论(0)
  • 2021-01-31 09:35

    Could it rather be that Jeff Atwood knows stored procedures will be around forever and was merely trying to stimulate thought and debate? I like to think that what he really would like to do is to write a persuasive essay entitled "Stored Procedures Considered Harmful" :)

    0 讨论(0)
  • 2021-01-31 09:39

    ORM and LINQ to SQL seem to be the current trends for replacing StoredProcs.

    I personally have used ORM and find it much easier to maintain and support.

    Some of the reasons stated for using stored procs where never legitimate reasons to begin with.

    You do make a good point about having a stored procedures when you service multiple applications; they essentially become the DAL, usually with some business logic in there.

    0 讨论(0)
提交回复
热议问题