Tom Neyland
Tom Neyland

Reputation: 6968

Does PostgreSQL have a limit on # of tables in a join?

Today when playing around with dynamic query generation I discovered that mysql has a hard maximum limit of how many tables can be used in a join: 61.

This lead me to wonder about PostgreSQL, does PostgreSQL have a analogous limit?

Note: I am asking this out of curiosity, not need.

Upvotes: 16

Views: 4891

Answers (1)

user330315
user330315

Reputation:

There is no limit AFAIK.

The query optimizer will switch to a different algorithm once a (configurable) limit of tables has been exceeded.But that just means the plan is calculated in a different way, not that the statement will fail (it might not be the fastest plan though).

http://www.postgresql.org/docs/current/static/planner-optimizer.html

Upvotes: 19

Related Questions