modified query output

From: Ariel Jakobovits <arieljake_at_yahoo.com>
Date: 25 Feb 2004 16:06:25 -0800
Message-ID: <127018e3.0402251606.2fbc03bf_at_posting.google.com>



I have an Experiment table with a field called performer_id which is a foreign key to the Performer table.

When outputting the contents of the Experiment table in an HTML file, I want to be able to put a link around the value of performer_id for each row that will link to a Performer Output page that displays the information for one performer.

Would it be faster/more efficient to:

  1. produce a new <A HREF="performer_output.cgi?performer_id=XXX"> string for each row

OR

b) produce a new <A HREF="performer_output.cgi?experiment_id=123"> string for each row that would tell me on the performer_output page to query the Experiment table for the performer_id where experiment_id=123.

The answer in this case seems to obviously be option (A) because there is the same amount of work done per row and no extra query.

But what if there are many foreign keys per Experiment record, and potentially, the foreign key tables, such as Performer, have multiple primary keys that are all kept in the Experiment table. I can produce a template <A HREF> for each field and replace placeholders with the primary key values from the query per row, but that seems like more work than one primary key id for the current experiment record (Option B).

What if the Experiment table has 1000s of records?

Looking forward to your answers,
TAOT, Ariel Received on Thu Feb 26 2004 - 01:06:25 CET

Original text of this message