database efficiency problem
am 01.09.2006 13:31:01 von TWIOFHI,
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?