Question about indexes on tables with inherited children

From: Bryan Montgomery <monty(at)english(dot)net>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Question about indexes on tables with inherited children
Date: 2010-06-16 15:07:59
Message-ID: AANLkTim7BO6ym0Qnac49TlZUQA34tz_OuVhDRBs0r8UT@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,
A quick question (I think).
If I have Table_A with id integer, val text - and no data.
Table_B inherits from Table_A and has a bunch of data.
Table_C inherits from Table_A and has some data.
Table_X has id integer, someValue integer

If I do select * from Table_A a, Table_X x where a.id = x.id
and it only returns 1 or a few rows, should it use an index if I have an
index built on Table_A using id?
Or do I need an index individually on B & C?
I thought having the index on A would be used, but in an analyze it was
scanning the table until I created indexes on B & C.

If it should have worked, the only thing that I can think of was that the
stats on the tables were maybe out of date? This is on 8.4.3.

Thanks,
Bryan.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bryan Montgomery 2010-06-16 15:10:09 Re: GSS Authentication
Previous Message Stephen Frost 2010-06-16 15:05:16 Re: GSS Authentication