Subject RE: [firebird-support] Creating indexes on array columns
Author Nigel Weeks
> Yup. An array type is just a specialised blob, can't index
> it, can't put
> constraints on it.
>
> As for ideas - I can't off-hand think of what characteristic
> of an array
> would lend it to indexing. An array supposedly stores a
> finite series of
> congruent values. If there's an attribute of the series that
> requires it
> to be constrained in any other way, then the obvious
> relational solution is
> to make a table for these series...
>
> ./heLen

The reason I was trying to index the array was to simulate a spatial
datatype for a 3D point in space, so finding it in a quagmire of points was
rapid.

Hmm, normal fields, possibly with a three-way index might be quicker, and
searches will always be performed looking for all three values each time:

CREATE DOMAIN coord AS NUMERIC(3,10);

CREATE TABLE point (
int_point INT64 NOT NULL,
int_X COORD NOT NULL,
int_Y COORD NOT NULL,
int_Z COORD NOT NULL,
PRIMARY KEY(int_point)
UNIQUE(int_x,int_y,int_z)
);

actually, the unique index might be sufficient for all searching anyway...

Does anyone know the difference between B-trees and R-trees, and which would
be better here?

Nige.

Nigel Weeks
Tech Support & Systems Developer
nweeks@...
www.examiner.com.au
71 - 75 Paterson Street
Launceston
Tasmania 7250
Australia
Phone: 03 6336 7234