472,111 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,111 software developers and data experts.

database efficiency problem

HI,

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?

Sep 1 '06 #1
1 2106
TWIOF wrote:
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?
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.
Sep 1 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Nathan Bloomfield | last post: by
335 posts views Thread by extrudedaluminiu | last post: by
10 posts views Thread by Jay | last post: by
10 posts views Thread by ircmaxell | last post: by
Chrisjc
3 posts views Thread by Chrisjc | last post: by
13 posts views Thread by Jonathan Wood | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.