以前面试的时候被问道为啥用mysql存储过程,或者存储过程的优点。作为一个专业的mysql dba。肯定是必须要掌握的。而我只是运维啊 哈哈哈。当时回答的不好,后来整理了
大概这几条,存储过程执行速度快,存储过程能够减少网络流量,提高应用程序代码的灵活性,提高数据安全保护机制。
狂汗啊!看人家洋鬼子整理的多齐整啊。师夷长技以制夷,奋起啊!!!
• The use of stored programs can lead to a more secure database.
• Stored programs offer a mechanism to abstract data access routines, which canimprove the maintainability of your code as underlying data structures evolve.• Stored programs can reduce network traffic, because the program can work on
the data from within the server, rather than having to transfer the data across thenetwork.• Stored programs can be used to implement common routines accessible frommultiple applications—possibly using otherwise incompatible frameworks—executed either within or from outside the database server.• Database-centric logic can be isolated in stored programs and implemented byprogrammers with more specialized, database experience.• The use of stored programs can, under some circumstances, improve the porta-bility of your application. 1: 存储程序的是使用可以使你的数据库更安全2:存储程序提供了一种数据访问的抽象机制,它能够极大的改善你的代码在底层数据结构演化过程中的易维护性
3:存储程序可以降低网络拥阻,因为属于数据库服务器的内部数据,这相比在网上传输数据要快的多
4:存储程序可以替多种使用不同构架的外围应用实现共享的访问例程,无论这些构架是基于数据库服务器外部还是内部。5:以数据为中心的逻辑可以被独立的放置于存储程序中,这样可以为程序员带来更高,更为独特的数据库编程体验6:在某些情况下,使用存储程序可以改善应用程序的可移植性