se_spatialkey.sql 909 B

12345678910111213141516171819202122232425262728
  1. -- This example demonstrates how to use SE_SpatialKey to build
  2. -- an R-Tree index on a clustered table.
  3. -- Step 1. Create the cities table which will contains the names
  4. -- and locations of world cities.
  5. CREATE TABLE cities (name varchar(255),
  6. locn ST_Point);
  7. -- Step 2. Populate this table with data from a DB-Access load file.
  8. -- This data file is included with the Spatial DataBlade Module as
  9. -- part of this example. It contains the names and locations of
  10. -- approximately 300 world cities.
  11. LOAD FROM cities.load INSERT INTO cities;
  12. -- Step 3. Create a clustered functional btree index.
  13. CREATE CLUSTER INDEX cbt_idx ON cities (SE_SpatialKey(locn));
  14. -- Step 4. Create an R-Tree index with the "NO_SORT" option.
  15. CREATE INDEX locn_idx ON cities (locn ST_Geometry_ops)
  16. USING RTREE (BOTTOM_UP_BUILD='yes', NO_SORT='yes');
  17. -- Step 5. Drop the btree index.
  18. DROP INDEX cbt_idx;