pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedcan I index a field of type "point"?
2+ messages / 2 participants
[nested] [flat]
* can I index a field of type "point"?
@ 2000-01-24 00:36 Mark Stosberg <mark@summersault.com>
2000-01-24 02:24 ` Re: [SQL] can I index a field of type "point"? Gene Selkov, Jr. <selkovjr@mcs.anl.gov>
0 siblings, 1 reply; 2+ messages in thread
From: Mark Stosberg @ 2000-01-24 00:36 UTC (permalink / raw)
To: pgsql-sql
Hello!
Is there a way to index a point field? The obvious method didn't work
for me:
mark=> create index lon_lat_idx on zip (lon_lat);
ERROR: Can't find a default operator class for type 600
I'm using Postgres v 6.5.3
Thanks,
-mark
<<-------------------------------------------------------------->>
personal website < Summersault Website Design
http://mark.stosberg.com/ > http://www.summersault.com/
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] can I index a field of type "point"?
2000-01-24 00:36 can I index a field of type "point"? Mark Stosberg <mark@summersault.com>
@ 2000-01-24 02:24 ` Gene Selkov, Jr. <selkovjr@mcs.anl.gov>
0 siblings, 0 replies; 2+ messages in thread
From: Gene Selkov, Jr. @ 2000-01-24 02:24 UTC (permalink / raw)
To: pgsql-sql; +Cc: mark@summersault.com
> Hello!
>
>
> Is there a way to index a point field? The obvious method didn't work
> for me:
> mark=> create index lon_lat_idx on zip (lon_lat);
> ERROR: Can't find a default operator class for type 600
It is true that there is no default opclass for point. As a matter of
fact, there is no opclass for defined for point at all. You can try
box_ops, though:
create table zip (lon_lat point);
insert into zip values('120,47');
insert into zip values('120,48');
insert into zip values('120,49');
insert into zip values('122,47');
insert into zip values('124,60');
create index lon_lat_idx on zip using rtree (lon_lat box_ops);
This seems to work:
test=> select * from zip where lon_lat ~= '120,47';
lon_lat
--------
(120,47)
(1 row)
test=> select * from zip where lon_lat @ '120,45,125,49';
lon_lat
--------
(120,47)
(120,46)
(2 rows)
However, you might want to check it out with a substantial data set
and verify that this index is actually used. If it isn't, I would
simply represent points as boxes.
--Gene
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-01-24 02:24 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-01-24 00:36 can I index a field of type "point"? Mark Stosberg <mark@summersault.com>
2000-01-24 02:24 ` Gene Selkov, Jr. <selkovjr@mcs.anl.gov>
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