Re: help with getting index scan

From: Masaru Sugawara <rk73(at)sea(dot)plala(dot)or(dot)jp>
To: "Thomas T(dot) Thai" <tom(at)minnesota(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: help with getting index scan
Date: 2002-03-02 22:28:00
Message-ID: 20020303063920.5A38.RK73@sea.plala.or.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 25 Feb 2002 10:51:15 -0600 (CST)
"Thomas T. Thai" <tom(at)minnesota(dot)com> wrote:

>
> it does seem that the index scan is slightly faster, but the overall
> results feels roughly about the same. here are the explains:
>
> explain SELECT *
> yellowpages-# FROM
> yellowpages-# (SELECT p.name,p.address,p.city,p.state,
> yellowpages(#
> geo_distance(point(z.longitude,z.latitude),point(p.long,p.lat)) as dist
> yellowpages(# FROM phone_address AS p, phone_cat AS pc,
> phone_cat_address AS pca, zipcodes AS
> z
> yellowpages(# WHERE z.zip_code='55404'
> yellowpages(# AND (pc.nameftx ## 'salon' AND pc.cid=pca.cid AND
> pca.aid=p.aid)
> yellowpages(# ) AS ss
> yellowpages-# WHERE dist < 35
> yellowpages-# ORDER BY dist LIMIT 20;

Does a setting of the sort_mem still have a default value ?
Could you try a series of your challenges again after rewriting the
postgresql.conf if so ?

Could you, in addition, execute the following queries in stead of the
original and show us the explain output for them ? But I'm not sure
they work faster than the original

set enable_seqscan to on;
explain analyze --- (1)
SELECT *
FROM (SELECT p.name, p.address, p.city, p.state,
geo_distance(point(z.longitude, z.latitude),
point(p.long, p.lat)) as dist
FROM phone_address AS p,
(SELECT * FROM phone_cat WHERE nameftx ## 'salon') AS pc,
phone_cat_address AS pca,
zipcodes AS z
WHERE z.zip_code='55404' AND pc.cid=pca.cid AND pca.aid=p.aid
) AS ss
WHERE ss.dist < 35
ORDER BY ss.dist
LIMIT 20;

explain analyze --- (2)
SELECT *
FROM (SELECT p.name, p.address, p.city, p.state,
geo_distance(point(z.longitude, z.latitude),
point(p.long, p.lat)) as dist
FROM phone_address AS p,
(SELECT * FROM phone_cat WHERE nameftx ## 'salon'
ORDER BY cid) AS pc,
phone_cat_address AS pca,
zipcodes AS z
WHERE z.zip_code='55404' AND pc.cid=pca.cid AND pca.aid=p.aid
) AS ss
WHERE ss.dist < 35
ORDER BY ss.dist
LIMIT

Regards,
Masaru Sugawara

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Campano, Troy 2002-03-02 23:19:05 Help with JDBC and OID
Previous Message Tom Lane 2002-03-02 18:55:07 Re: Is vacuum full lock like old's vacuum's lock?