pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Busby <busby@pnts.com>
To: pgsql-general@postgresql.org
To: pgsql-performance@postgresql.org
Subject: Index/Foreign Key Question
Date: Fri, 10 Oct 2003 14:04:51 -0700
Message-ID: <006a01c38f72$25461720$1100000a@busbydev> (raw)

List,
    I'm creating this multi company POS database.
My inventory table looks like (all items are unique):

id,category_id,invoice_id,x,y,z,gid,uid

I have a primary key on id, and then an foreign keys on category_id and
invoice_id.
GID is the group ID of the company, UID is the companies user, they are also
connected via foreign key to the respective tables.  My question is this: Do
I need to create more indexes on this table when inventory selects look like

select * from inventory where
 category_id = 1 and invoice_id is null and gid = 2

So where would the indexes need to be placed?  Or since I have the FK setup
are the indexes already in place?  I expect to soon have >500K items in the
inventory table and don't want it to slow down.  I'll have the same type of
issue with clients, invoices, purchase_orders and perhaps more

Ideas?

Thanks!

David Busby
Systems Engineer




view thread (7+ messages)  latest in thread

Message-ID: <006a01c38f72$25461720$1100000a@busbydev>
Permalink:  ../006a01c38f72$25461720$1100000a@busbydev/
Also on:    postgresql.org/message-id/006a01c38f72$25461720$1100000a@busbydev

 · 

reply

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: busby@pnts.com, pgsql-general@postgresql.org
  Subject: Re: Index/Foreign Key Question
  In-Reply-To: <006a01c38f72$25461720$1100000a@busbydev>
  References: <006a01c38f72$25461720$1100000a@busbydev>

* 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