Design suggestions - performance improvement
| From: | Matthew Nock | Date: | Thu, 09 Jan 2003 23:10:54 +0000 |
| Subject: | Design suggestions - performance improvement | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-24732@lists.php.net to get a copy of this message | ||
Hi all,
I am currently building a site for a cinema to display session times, film synopsis' etc...
I have built the database as follows:
TABLE: film_detail
FilmID
FilmName
FilmRunTime
FilmRating
FilmSynopsis
etc...
TABLE session_data
session_ID
session_filmID
session_StartTime
session_Date
The session_data table might contain a large number of records with the same film ID, and the same
Start Date to cover a large number of sessions that we would have of the same film on the same day.
I want to know what is the best way to retrieve this joint info from the DB.
currently, I run a single select statement requesting the fields I want from both tables, where the
session_Date equals a given date. This returns x number of rows, depending on the number of
sessions for all films for that given day.
However, this means that I am retrieving the Film Synopsis, cast, runtime etc multiple times...
The data will be returned to the user as below:
FILM TITLE (rating)
session_times <--- will list all sessions - such as 8.45am, 10.15am, 12.00pm, 2.00pm etc etc
FILM RUNTIME
FILM CAST
FILM SYNOPSIS
is this an effective way to return to he data? or should I be using individual queries?
Any comments or suggestions would be most appreciated..
Cheers,
M@