From: Victor Yegorov <viy@nordlb.lv>
To: Rudi Starcevic <rudi@oasis.net.au>
Cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: Postgres Performance <pgsql-performance@postgresql.org>
Subject: Re: constraint with reference to the same table
Date: Thu, 15 May 2003 04:58:11 +0300
Message-ID: <20030515015811.GE1549@nordlb.lv> (raw)
In-Reply-To: <3EC2F1E4.8080706@oasis.net.au>
References: <20030514181136.S52444-100000@megazone23.bigpanda.com>
<3EC2F1E4.8080706@oasis.net.au>
* Rudi Starcevic <rudi@oasis.net.au> [15.05.2003 04:46]:
> Stephen,
>
>
> New:
> CREATE TABLE business_person
> (
> b_id integer REFERENCES business ON UPDATE CASCADE ON DELETE CASCADE NOT
> NULL,
> pn_id integer REFERENCES person ON UPDATE CASCADE ON DELETE CASCADE NOT NULL
> PRIMARY KEY(b_id,pn_id);
> );
> CREATE INDEX b_pn_b_id_idx ON business_person (b_id);
> CREATE INDEX b_pn_pn_id_idx ON business_person (pn_id);
May be it's better to name indexes a bit more clearer? No impact on overall
performance, but you'll ease your life, if you project will grow to hundreds
of tables and thousands of indicies.
> As I'd like to sometime's look up business's, sometime's look up people and
> sometimes
> look up both I think I should keep the Index's.
If your lookups are part of business logic, than it's ok. Also, if your
system generates reports using several table joins that may speed up the
things.
Otherwise, for curiosity cases, it's better to wait some time for the result
of one-time queries.
--
Victor Yegorov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: viy@nordlb.lv, rudi@oasis.net.au, sszabo@megazone23.bigpanda.com
Subject: Re: constraint with reference to the same table
In-Reply-To: <20030515015811.GE1549@nordlb.lv>
References: <20030514181136.S52444-100000@megazone23.bigpanda.com> <3EC2F1E4.8080706@oasis.net.au> <20030515015811.GE1549@nordlb.lv>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox