Stored procedures in Ruby on Rails(Ruby on Rails 中的存储过程)
问题描述
我是一个拥有 6 年经验的 .net 人.最近我开始研究 ROR 项目并意识到根本没有使用存储过程/sql 函数.在询问它时,我知道这是一种常见的做法,通常团队中根本没有人编写 sql 查询,一切都是使用 ActiveRecord 完成的.
I am a .net guy with 6 years of experience. Recently I started working on ROR project and realized that stored procedures/sql functions are not being used at all. On inquiring about it I got to know that it is common practice and in general nobody in team writes a sql queries at all, everything is done using ActiveRecord.
我在谷歌上搜索了任何可能的原因,但没有找到太多信息.所以我只是想知道
I googled about any possible reasons for this but didn't find much information. So I am just curios to know
- 不喜欢使用存储过程/sql 函数是一种常见的做法吗?
- 使用存储过程的优缺点是什么?
推荐答案
不喜欢使用存储过程/sql 函数是一种常见的做法吗?
Is it common practice that stored procedures/sql functions are not preferred to use?
非常很常见,大多数 Rails 应用将永远不需要使用 ActiveRecord 以外的任何东西.
It is very common, most Rails apps will never need to use anything more than ActiveRecord.
Rails 背后的主要理念之一是,将有效产品推向市场今天比将快速"产品推向市场更重要 6几个月后.您的产品几乎肯定不会流行到足以让性能成为问题的程度.如果这确实成为一个问题,您可以稍后在性能方面提供支持,但当务之急是能够快速构建应用程序,并能够快速重构部分或全部以响应您的市场.
One of the chief philosophies behind Rails is that it's more important to get a working product to market today than it is to get a "fast" product to market 6 months from now. Your product will almost certainly never be popular enough for performance to be a concern. If that does become a problem, you can shore up the performance side of things later, but the immediate concern is to be able to build an app quickly, and to be able to rapidly refactor some or all of it in response to your market.
使用存储过程的优缺点是什么?
What are pros and cons of using stored procedures?
它们的编写速度较慢且更难更改,因此会增加您的开发成本.但是,它们的执行速度可以更快.
They're slower to write and more difficult to change, and therefore front-load your development costs. However, they can be faster to execute.
这篇关于Ruby on Rails 中的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Ruby on Rails 中的存储过程
基础教程推荐
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01