Database performance

From: Marcel Braak <mbraak_at_xs4all.nl>
Date: Fri, 21 Sep 2001 16:14:48 +0200
Message-ID: <3bab4b96$0$65655$e4fe514c_at_newszilla.xs4all.nl>



Hi there,

I really need some help here.

I'm developing an application in wich people can be planned on jobs. I need to display a diagram in wich all people are displayed in segments of 30 minutes.
Those segments show if a person is planned at that time or not.

My problem is that my way of querying is very slow with many people

Let say we have.

100 persons
I want to see a diagram from 7 to 7 hours in segments of 30 minutes.. so 12 hours*2=24 segments
thus for 1 person i need 24 queries to find out if that person is free or busy at a timesegment
For all 100 persons i need 24*100=2400 queries. Let's say three people are accessing this diagram at the same time. The SQL server has to execute 2400*3=7200 queries.

I'm using queries like
SELECT persid FROM planning WHERE persid='name' AND starttime <= '10:00' AND endtime > '10:30'

Is there a better way to query the database to find out if somebody is planned at a given timesegment?

Thanx,
Marcel Received on Fri Sep 21 2001 - 16:14:48 CEST

Original text of this message