PostgreSQL:postgreSQL数据库中最多可以存储多少个表? [英] PostgreSQL: What is the maximum number of tables can store in postgreSQL database?

查看:1346
本文介绍了PostgreSQL:postgreSQL数据库中最多可以存储多少个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Q1:数据库中最多可以存储多少个表?

Q1: What is the maximum number of tables can store in database?

第二季度:在视图中可以合并的表的最大数量是多少?

Q2: What is the maximum number of tables can union in view?

推荐答案

问题1:文档。实际上,某些操作在表数上为O(n);预计计划时间会增加,并且当您访问数据库中成千上万的表时会遇到诸如自动清空等问题。

Q1: There's no explicit limit in the docs. In practice, some operations are O(n) on number of tables; expect planning times to increase, and problems with things like autovacuum as you get to many thousands or tens of thousands of tables in a database.

第二季度:这取决于查询。通常,庞大的工会是一个坏主意。表继承会更好一些,但是如果您使用 constraint_exclusion 将导致计划时间大大增加。

Q2: It depends on the query. Generally, huge unions are a bad idea. Table inheritance will work a little better, but if you're using constraint_exclusion will result in greatly increased planning times.

这两个问题都表明您的设计存在潜在的问题。您不应该需要大量的桌子和巨型工会。

Both these questions suggest an underlying problem with your design. You shouldn't need massive numbers of tables, and giant unions.

通过另一个答案中的注释,您实际上应该是创建一些表。您似乎想为每个电话号码创建一个表格,这是荒谬的,并在每个电话号码之上创建视图。请勿这样做,因为数据建模不正确,将使处理起来更加困难而不是更容易。索引,where子句和联接将使数据在逻辑上分成几个表时,可以更有效地使用数据。我建议研究基本的关系建模。

Going by the comment in the other answer, you should really just be creating a few tables. You seem to want to create one table per phone number, which is nonsensical, and to create views per number on top of that. Do not do this, it's mismodelling the data and will make it harder, not easier, to work with. Indexes, where clauses, and joins will allow you to use the data more effectively when it's logically structured into a few tables. I suggest studying basic relational modelling.

如果以后遇到可伸缩性问题,可以查看分区,但是您不需要成千上万个表。

If you run into scalability issues later, you can look at partitioning, but you won't need thousands of tables for that.

这篇关于PostgreSQL:postgreSQL数据库中最多可以存储多少个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆