pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matt Behrens <matt@iserv.net>
To: pgsql-sql@postgresql.org
Subject: Selecting with a large number of foreign keys
Date: Tue, 04 May 1999 16:47:43 -0400
Message-ID: <372F5CEF.40A8B29@iserv.net> (raw)

I didn't get any answers from the -novice list, maybe you folks know?

In my call tracking database, I have quite a few fields that are numbers
representing primary keys in a number of smaller tables; these are used
when there is a drop-down list of choices that someone can pick from.

My problem is that when I do reports on these, I want to see the name of
the selection instead of the number.  I tried doing this with the
following query (which seems to work well for a small number of these
fields):

SELECT	call_table.field_one,
	call_table.field_two,
	field_three_table.name AS field_three
WHERE 	field_three_table.id = call_table.field_three;

However, when I start doing this with a LOT of fields, I notice the
backend process growing extremely large (just pulling up all the calls
for two days with 20 fields selected resulting in the backend growing >
50 MB and taking a loooong time.)  Is there a better way to do these?

-- 
Matt Behrens <matt@iserv.net>
Network Operations Center, The Iserv Company



view thread (3+ messages)  latest in thread

Message-ID: <372F5CEF.40A8B29@iserv.net>
Permalink:  ../372F5CEF.40A8B29@iserv.net/
Also on:    postgresql.org/message-id/372F5CEF.40A8B29@iserv.net

 · 

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-sql@postgresql.org
  Cc: matt@iserv.net
  Subject: Re: Selecting with a large number of foreign keys
  In-Reply-To: <372F5CEF.40A8B29@iserv.net>
  References: <372F5CEF.40A8B29@iserv.net>

* 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