473,834 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2144
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3268
by: Rada Chirkova | last post by:
Hi, at NC State University, my students and I are working on a project called "self-organizing databases," please see description below. I would like to use an open-source database system for implementation and would really appreciate your opinion on whether PostgreSQL is suitable for the project. In general, I am very impressed by the quality of PostgreSQL code and documentation, as well as by the support of the developer community. ...
1
4533
by: Scott Chapman | last post by:
I am working with Python (psycopg). I have HTML with embedded Python that I'm inserting into a database and it could contain any character. Single quotes, at least, must be escaped (to two single quotes, right?) before inserting it into Postgres. This poses a problem when I get the data out of the table. It could have originally contained two single quotes together and I replace them with one single quote in the unescaping process.
1
1933
by: Nathan Bloomfield | last post by:
Hi, I am a new database developer and would appreciate some advice on improving the efficiency of my database. The code below is an example of one of the more complex queries in the database (very basic in the scheme of things). Can anyone offer advice in improving the structure considering this database resides on a network with limited bandwidth. The query runs
13
2204
by: MLH | last post by:
I have a RDBMS app consisting of 3 primary mdb's... 1) a front-end with a few STATIC tables and the other menagerie of objects 2) a back-end with most of my DYNAMIC tables. I'll call it my main backend. 3) another back-end = zip.mdb with about 43000 zips/cities/states The app has been operating stably (is that a word?) for some years. No probs. The main backend is 63.3 megs now and contains tens of thousands of letters - legal...
31
2652
by: mark | last post by:
Hello- i am trying to make the function addbitwise more efficient. the code below takes an array of binary numbers (of size 5) and performs bitwise addition. it looks ugly and it is not elegant but it appears to work. using time, i measured it takes .041s to execute, which i admit isnt much. but, the problem is that this procedure will be called many, many times in my project (probably at least a few thousand times, if not more) so...
335
11902
by: extrudedaluminiu | last post by:
Hi, Is there any group in the manner of the C++ Boost group that works on the evolution of the C language? Or is there any group that performs an equivalent function? Thanks, -vs
10
3855
by: Jay | last post by:
In C# I can set up an Enum so that number are represented as keywords, which is very useful. Is there such a datatype in a database? I suppose I could use an extra table, with the ID column as the number, and a corresponding column with strings representing the keywords. This sounds a bit inefficient - is there a better way?
10
3306
by: ircmaxell | last post by:
Ok, I have a program that reads the contents of a file (1 line, 5 '|' seperated items). Every so often (between twice a day, and 200 times a day), it rewrites the contents of that file. I also do a few database update queries whenever the file is written. I only open up the database connector if I need to update the database. The script itself runs every 30 seconds. My question, is that is it faster and more efficient to read the file...
3
1383
Chrisjc
by: Chrisjc | last post by:
I was told the other day that I was able to place HTML in my database.. So I thought to my self that be grate for my feature points so I can use bullets... so I put the following code in one of my COL's just to see if it work here is the following code. <ul> <li>Pro-GUARD 7 high flow, high efficiency filter media air filter</li> <li>Increases horsepower up to 100 HP depending on application</li> <li>Improves torque up to 112 lbs/ft...
13
1403
by: Jonathan Wood | last post by:
I'd like to build a Website that contains many articles. Two basic approaches are to either store the articles in aspx files, possibly indexed by the database, or to store the article text in the database. Some advantages of storing them in files are simplicity, and efficiency. Some advantages of storing them in the database are ease of some operations, and the option of using SQL Server 2005 text index to implement search. Can...
0
9800
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10800
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10225
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9339
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7762
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5800
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3987
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3085
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.