[quoted text, click to view] On Wed, 20 Sep 2006 01:21:35 +0200, Hugo Kornelis wrote:
> A test with 10,000 tables and 10,000 FK constraints all to
>the same table is still running (3 minutes already) while I type this.
Just finished, after 51 minutes and 18 seconds (according to the clock
in SSMS).
Result: error. Not while creating the tables and constraints, but while
deleting the single row from table T.
Msg 8623, Level 16, State 1, Line 1
The query processor ran out of internal resources and could not produce
a query plan. This is a rare event and only expected for extremely
complex queries or queries that reference a very large number of tables
or partitions. Please simplify the query. If you believe you have
received this message in error, contact Customer Support Services for
more information.
In the mean time, I found this in Books Online:
"The Database Engine does not have a predefined limit on either the
number of FOREIGN KEY constraints a table can contain that reference
other tables, or the number of FOREIGN KEY constraints that are owned by
other tables that reference a specific table.
"Nevertheless, the actual number of FOREIGN KEY constraints that can be
used is limited by the hardware configuration and by the design of the
database and application. We recommend that a table contain no more than
253 FOREIGN KEY constraints, and that it be referenced by no more than
253 FOREIGN KEY constraints. The effective limit for you may be more or
less depending on the application and hardware. Consider the cost of
enforcing FOREIGN KEY constraints when you design your database and
applications."
(ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/1e068443-b9ea-486a-804f-ce7b6e048e8b.htm)
--