[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] Question about a CIDR based query

2004-06-26 Thread George Siganos
I did a vacuum analyze before I run the following explain June_03=# explain select * from tmp where route ='62.1.1.0/24'; QUERY PLAN Seq Scan on tmp (cost=0.00..606.60

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