有没有办法或技术可以实现基于用户的数据库资源分配?
通常,当平台想要向用户(开发者)提供数据库资源用于应用程序开发时,他们会使用限制数据库访问API来限制应用程序的行为,以对占用的资源施加一些约束,例如社交API。
我们是否可以在数据库层或应用程序层实现和使用相同的方法。如果那样,我们只需要为特定用户分配数据库配额,并让数据库处理资源使用情况。此外,最好有一些来自数据库服务器的编程 API 来支持这一点。
我发现了一些类似的问题,如下:
- Oracle [可能有]:有没有办法限制或限制 Oracle 中用户使用的资源?
- MySQL [no]: https://serverfault.com/questions/124158/数据库中的用户使用的节流或限制资源
- SQL Server [不确定]:具有利用率限制的数据库
由于我专注于开源解决方案,那么 PostgreSQL 或 NoSQL 怎么样?作为开源数据库,我认为PostgreSQL比Oracle更有优势。
Typically, when platforms want to provide database resource to user (developer) for applications development, they use limit database access APIs to restrict behaviors of the application, in order to enforce some constraints on resources occupied, an example is social API.
Is there a same way that we can implement and use in database layer, nor application layer. If then, we just need to assign database quota for specific user and let database handle the resource usage. Furthermore, it's better to have some programming APIs from database server to support this.
I found some similar questions, as follow:
- Oracle [might has]: Is there a way to throttle or limit resources used by a user in Oracle?
- MySQL [no]: https://serverfault.com/questions/124158/throttle-or-limit-resources-used-by-a-user-in-a-database
- SQL Server [not sure]: Databases with utilization constraints
Since i am focus on open source solutions, how about PostgreSQL or NoSQL? As open source database, I think PostgreSQL compares better favourably with Oracle.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 MySQL(目前根据开源 GPL 许可证发布),您可以在数据库内施加以下资源限制:
对于 postgres,< a href="http://wiki.postgresql.org/wiki/Priorities#Prioritizing_users.2C_queries.2C_or_databases" rel="nofollow noreferrer">他们的 wiki 状态:
但对我来说,真正的问题是——无论使用哪个数据库——当用户超出其限制时,期望是什么?如果数据库强制执行限制,那么超出这些限制的查询是否应该简单地返回错误并导致应用程序失败?我怀疑这可能会对应用程序产生意想不到的负面影响。很难说当数据库突然开始返回错误时会发生什么。
With MySQL (which is currently released under the open source GPL license), you can impose the following resource limits inside the database:
For postgres, their wiki states:
But the question to me really is -- no matter which database is used -- what is the expectation when a user exceeds their limits? If the database enforces limits, should queries beyond those limits simply return an error and cause the application to fail? I'd suspect that this might have unexpected negative impacts on the applications. It's hard to say what will happen when suddenly the database starts returning errors.