Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id LAA87208; Thu, 3 Feb 2000 11:26:35 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id LAA27995; Thu, 3 Feb 2000 11:26:11 -0500 (EST) To: Chris cc: Bruce Momjian , pgsql-hackers@postgreSQL.org, pgsql-sql@postgreSQL.org Subject: Re: [HACKERS] Re: [SQL] Proposed Changes to PostgreSQL In-reply-to: <38997D1C.9F353FED@bitmead.com> References: <200002031237.HAA21220@candle.pha.pa.us> <38997D1C.9F353FED@bitmead.com> Comments: In-reply-to Chris message dated "Fri, 04 Feb 2000 00:05:32 +1100" Date: Thu, 03 Feb 2000 11:26:11 -0500 Message-ID: <27991.949595171@sss.pgh.pa.us> From: Tom Lane Chris writes: > Why not change that to a relnumindexes as well? Easier to maintain and > more useful information. Maintaining an accurate count of descendants (or indexes for that matter) would be expensive; in particular, it'd create severe concurrency problems. If one transaction is in the middle of creating or dropping a child C of table P, then all other transactions would be blocked from creating or dropping any other children of P until the C transaction commits or aborts. They'd have to wait or they wouldn't know what to set relnumchildren to. For the purpose at hand, I think it would be OK to have a "relhaschildren" field that is set true when the first child is created and then never changed. If you have a table that once had children but has none at the moment, then you pay the price of looking through pg_inherits; but the case that we're really concerned about (a pure SQL, no-inheritance table) would still win. Not sure whether we can concurrently create/delete indexes on a rel, but I'd be inclined to leave relhasindexes alone: again its main function in life is to let you short-circuit looking for indexes on a table that's never had and never will have any. regards, tom lane