Multiple values for a field - Mailing list pgsql-sql

From Mike Field
Subject Multiple values for a field
Date
Msg-id 008701bee59e$0e951f80$0200a8c0@mike
Whole thread Raw
Responses Re: [SQL] Multiple values for a field
List pgsql-sql
Hi-
 
Does anyone have any ideas on the following?

In my database that categorizes research documents and publications, I have
in some cases more than one author, more  than one region, subject, etc. per
document.  You mentioned yesterday that the best way to handle that is to
have a table for say, authors like this:

docid   |   authorid

and have more than one row for a document if that document has more than one
author.

My problem is that I'm pulling the info out of the database on the web, and
I find that I have to use a loop for the fields that have multiliple
values - and since I have several of those fields, many loops starts to bog
down the processor.  My objective is to try to get all the data out, for all
documents, in one single query - so that I can make a list of all the
documents and their pertinent data.

Do you see any problem if I put the actual names of the authors, comma
separated, in the author field (for example:  Mike Field, Tom Lane, ZZ Top)?
I would do the same for my six fields which may have multiple values
(author, region, subject, related_projects, doc_type, translations) I have
about 550 documents to put into the database.

I know using text fields would take up more space relative to just using a
number to refer to the author... but using a number makes me perform more
loops and thus, more processing time.

Let me know what you think.
Thanks,
Mike

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] Problems with default date and time
Next
From: "Hutton, Rob"
Date:
Subject: RE: [SQL] Problems with default date and time