Re: [SQL] Need indexes on inherited tables?

2004-06-28 Thread Franco Bruno Borghesi
you can find more information here: http://www.postgresql.org/docs/7.4/static/sql-createtable.html (under the parameters section). For unique constraints, the only thing I can think of is a table check constraint (SELECT count(pk)=0). I agree with you, right now there are many inconveniences

[SQL] Need indexes on inherited tables?

2004-06-26 Thread Phil Endecott
Dear Postgresql experts, I have a base table that declares a primary key spanning a couple of columns: create table B ( id integer, xx someothertype, . primary key (id, xx) ); and a number of derived tables that inherit from B: create table T ( ) inherits (B); An index is

Re: [SQL] Need indexes on inherited tables?

2004-06-26 Thread Franco Bruno Borghesi
Table T is not inheriting any indexes, neither the primary key constraint. That means that the search is going to use an index scan on table B and a sequential scan on table T (unless of course you add a primary key constraint or an index on table T). You can check this things doing: -SET

Re: [SQL] Need indexes on inherited tables?

2004-06-26 Thread Phil Endecott
I asked if derived tables use primary key indexes generated in the base tables that they inherit from. Franco Bruno Borghesi replied: [the derived table] is not inheriting any indexes, neither the primary key constraint. OK, thanks! I had come to the conclusion that it was not using the

Re: [SQL] Need indexes on inherited tables?

2004-06-26 Thread Karsten Hilbert
Is this a possible area for future enhancements? Yes. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 ---(end of broadcast)--- TIP 8: explain analyze is your friend