query's performance - Mailing list pgsql-general

From hmidi slim
Subject query's performance
Date
Msg-id CAMsqVxu8Fme013y-5Zy7SwwBxMdmTJCu81Ym_YAKrFshw4kCUQ@mail.gmail.com
Whole thread Raw
Responses Re: query's performance  (PT <wmoran@potentialtech.com>)
List pgsql-general
Hi,
I have a table establishment which contains these columns: id, name, longitude, latitude.
I want to select all the establishments in the table establishment within a radius from a reference point  which is a given establishment.
For example:
I have a given establishment called establishment1 and has an id=1.
I want to display all the establishments within a radius 1km from this establishment.
I wrote this query:
select e.name,e1.name, e1.longitude, e1.latitude
from establishment as e, establishment as e1
where e.id = 1
and e.id <> e1.id
and ST_DWithin(ST_SetSRID(ST_MakePoint(e1.longitude, e1.latitude), 4326),ST_MakePoint(e.longitude, e.latitude)::geography, 1000) ;

Is it a good practice to iterate the rows of the table like I did and does not have an effect in the performance if the number of table's rows increase?
  

pgsql-general by date:

Previous
From: Don Seiler
Date:
Subject: vacuumdb --all Parallel Feature Request
Next
From: PT
Date:
Subject: Re: Can parallel vacuum commands lead to a lock in Postgres 10.2