Mark Jewiss wrote:
>
> Hello,
>
> On Tue, 25 Jan 2000, Chairudin Sentosa Harjo wrote:
>
> > $sql = "select a.pin, b.first_name, b.last_name,
> > start_time, duration,
> > country_code, area_code, phone_number,
> > a.service_type, total_units
> > from tbs_billing_record a, ibs_subscriber b
> > where a.pin=b.pin
> > and date(start_time) between '$begindate' and '$enddate'
> > and a.service_type='$service_type'
> > order by $sortby1,$sortby2";
>
> Ok, I've had a very quick look at this, and going on my past experiences,
> I'd say that the problem is the query above. I've always had horribly slow
> query returns when you are only pulling out rows with data between two
> dates.
>
> If you take the 'date between' line out of the query, how much quicker is
> the result returned?
>
> One way around this may be to create a temporary table that contains the
> results of the query that you want. Your script query would then be
> "select * from temptable".
>
> You'd then need some sort of schedule so that the temp table is updated
> every XX mins to suit your application - it comes down to working out how
> important accurate information is to your customer.
That's what I am doing now, however I only put one month data to
the temporary table. The problem is when two months data is needed,
I have to create another temporary table, and change my script again.
I may have to find a way to tell netscape not to timeout too quickly.
Do you have other suggestions?
Thanks
Regards,
Chai