Re: [GENERAL] Query time is too long for netscape - Mailing list pgsql-general

From Mark Jewiss
Subject Re: [GENERAL] Query time is too long for netscape
Date
Msg-id Pine.BSO.4.10.10001250938440.25942-100000@office.knowledge.com
Whole thread Raw
In response to Re: [GENERAL] Query time is too long for netscape  (Chairudin Sentosa Harjo <chai@prima.net.id>)
List pgsql-general
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.

Regards,

Mark.
--
Mark Jewiss
Knowledge Matters Limited
http://www.knowledge.com


pgsql-general by date:

Previous
From: Chairudin Sentosa Harjo
Date:
Subject: Re: [GENERAL] Query time is too long for netscape
Next
From: jean-charles savelli
Date:
Subject: Multi lingual DB