database efficiency problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

i have a set of tables reffering to various aspects of a nigh-life
listings system.

I have tables named gigs and venues. Each gig has a venue.

So when displaying the data on the site people might search for a
specific gig and then see what venue it is heled at and want to see
what other gigs are heled there. Pretty simple.

My problem is. When calling the venue info to the gig page I seem to
have three options and can't decide whch is most efficient (especially
as allot of users may be searching at once).:

1) TWO queries one to the gig table retreiving all data, then one to
the venue table using the venue_id in gigs to find the relevant venue
id (PK) data.

2) same as above but using a JOIN

3) ONE query, but using the venues name as the PK, then i could simply
disply the name straight out of the gigs table, and then pass this
allong to the view venues page. I know it's data replication, but are
fewer queries more eficient?

what do you all think?

Re: database efficiency problem

TWIOF wrote:

Quoted text here. Click to load it

3. is propably most efficient, but I recommend using the 2. because 3.
isn't good practice and can cause othe problems. The 2. should be
efficient enough for your needs if you just have proper indexes.

Site Timeline