From: mig@utdt.edu
To: klcollins@wsicorp.com
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL command speed
Date: Thu, 18 May 2000 16:38:29 -0300
Message-ID: <200005181938.QAA04835@ant.utdt> (raw)
In-Reply-To: <3924405E.15014E6B@wsicorp.com>
References: <3924405E.15014E6B@wsicorp.com>
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
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: mig@utdt.edu, klcollins@wsicorp.com
Subject: Re: SQL command speed
In-Reply-To: <200005181938.QAA04835@ant.utdt>
References: <3924405E.15014E6B@wsicorp.com> <200005181938.QAA04835@ant.utdt>
* 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