From: Kate Collins <klcollins@wsicorp.com>
To: mig@utdt.edu
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL command speed
Date: Thu, 18 May 2000 16:19:02 -0400
Message-ID: <39245036.71D4618F@wsicorp.com> (raw)
References: <3924405E.15014E6B@wsicorp.com>
<200005181938.QAA04835@ant.utdt>
Miguel,
Thank you for the reply.
I created a third script with the syntax you suggested, and the result
was similar to the first script, about 11.5 to 12 seconds.
The interesting thing is that in all three cases, when I use the unix
"time" command to time the execution, the "user" and "sys" portion of the
execution is about the same. user = 0.20, sys = 0.02.
This indicates to me that the bottle neck is not in the execution of the
PERL, but maybe in the postmaster daemon. The system I am testing with
is a PII, 400 mhz with 256 ram. It is not doing anything else at this
time, but running these test.
Interestingly enough under Oracle, the new script takes about the same
time as the other two, 1-1.5 seconds.
Kate Collins
mig@utdt.edu wrote:
> I believe the PostgreSQL optimizer is fooled by many ORs and switches
> to sequential scans: it cannot estimate properly the quantity of
> results that will be returned.
>
> Try it in one go, as
>
> $sql = "SELECT notam_id, TO_CHAR(full_issue_date, 'DD-MON-YYYY
> HH24:MI')
> FROM notam_details
> WHERE
> item_a IN
> ('EGKB','EGDM','EGHH','EGGD','EGVN','EGFF',
> 'EGDC','EGTC','EGDR','EGTE','EGLF','EGTG',
> 'EGBJ','EGLC','EGKK','EGLL','EGSS','EGGW',
> 'EGMD','EGDL','EGUM','EGHD','EGHE','EGKA',
> 'EGHI','EGMC','EGDG','EGFH','EGDY','EGJA',
> 'EGJB','EGJJ')";
>
> The optimizer should (I think) like this better and use the indices,
> without requiring that you iterate the queries from the frontend.
>
> As I am trying to learn these things too, I will appreciate knowing
> about the result of your tests: please keep me posted.
>
> Thanks
>
> Miguel Sofer
--
=================================================
Katherine (Kate) L. Collins
Senior Software Engineer/Meteorologist
Weather Services International (WSI Corporation)
4 Federal Street
Billerica, MA 01821
EMAIL: klcollins@wsicorp.com
PHONE: (978) 670-5110
FAX: (978) 670-5100
http://www.intellicast.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: klcollins@wsicorp.com, mig@utdt.edu
Subject: Re: SQL command speed
In-Reply-To: <39245036.71D4618F@wsicorp.com>
References: <3924405E.15014E6B@wsicorp.com> <200005181938.QAA04835@ant.utdt> <39245036.71D4618F@wsicorp.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox