Talk:Stored procedure
From Wikipedia, the free encyclopedia
Contents |
[edit] Opinion
From the article:
- By providing an API that implements business logic within the database using stored procedures, the need to duplicate logic within client programs is lessened or eliminated. [...].
This sounds a bit biased. The opposite is just as true. Duplication can be pushed either to the database or to the client programs, and there are arguably more effective ways to deal with it in the second case. The sentence seems to imply the case where there are many client programs that don't share anything above the database level. In this case the author is right, but this is a special case, not a general truth.
- Some critics claim that databases should be for storing data only, and that business logic should only be implemented by writing a business layer of code, through which client applications should access the data. However, the database system is intended to not only store the data but also to ensure its integrity and consistency.
"Some critics" refers to a large portion of the software development field, and probably a vast majority of software development thought leaders. The passage is an opinion and, as far as I know, not a very widely shared one.
Nitpicking:
- [...]a business layer of code, through which client applications should access the data.
The author seems to be talking about three-tier architectures. In this approach, the business layer is the core of the application, not the layer through which the application accesses data. The presence of a data layer access (for example an Object-Relational Mapper) as a subset of the business layer is not integral to the pattern - the business logics might access the data through many different means, like Active Records or Embedded SQL.
I won't modify the page right now - I'm waiting for comments.
Nusco 22:21, 15 December 2006 (UTC) 22:18, 15 December 2006 (UTC)
Nusco: I've made changes to this second "Some critics" paragraph. Do you approve? I'm of the opinion that there are considerable advantages to operating a business layer and using SPROCs. Indeed I do this myself. After the modification the paragraph now reads:
Some critics claim that databases should be for storing data only, and that business logic should only be implemented by writing a business layer of code, through which client applications should access the data. However, the use of stored procedures does not preclude the use of a business layer.
Markblue
[edit] Adding cleanup template
I'm adding a cleanup template the article because it looks as if it's evolved to be a bit disorganised. I'll have a go at it in the next little while if nobody else gets there first. Izogi 19:10, 7 April 2006 (UTC)
[edit] "The advantage of a stored procedure"
From the article:
- The advantage of a stored procedure is that when it is run, in response to a user request, it is run directly by the database engine, which usually runs on a separate database server and is generally faster at processing database requests.
Is this correct? It doesn't seem very clear to me. If I submit some inline SQL to a database engine, it will still execute just as quickly (except for things like compilation), it will execute inside the database engine, and will only return the results that the SQL query requested. I think what the author might have meant is that the result of multiple queries can be strung together inside the database engine, allowing an entire combined operation to be carried out internally without having to ferry intermediate results and further requests back and forth between database and application. Izogi 19:10, 7 April 2006 (UTC)
[edit] Merge from User Defined Function
- Merge and redirect UDF to here since this term is used in template - I'm not an SQL expert but it looks like two terms that are exactly the same. -- RevRagnarok Talk Contrib Reverts 11:59, 17 June 2006 (UTC)
-
- Stored procedures and UDFs are vastly different, and so they shouldn't be merged. -- Mikeblas 21:39, 17 June 2006 (UTC)
- I think your confusion came from a bad descrpition on the UDF page. I've edited that page and removed the merge tags. Let me know if you think it could be clearer or find any errors. I'll also some text to this article about UDFs to highlight the differences. -- Mikeblas 21:57, 17 June 2006 (UTC)
- Stored procedures and UDFs are vastly different, and so they shouldn't be merged. -- Mikeblas 21:39, 17 June 2006 (UTC)