[GRASS-SVN] r57462 - grass/trunk/lib/temporal/SQL
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Aug 17 15:15:59 PDT 2013
Author: huhabla
Date: 2013-08-17 15:15:59 -0700 (Sat, 17 Aug 2013)
New Revision: 57462
Modified:
grass/trunk/lib/temporal/SQL/map_stds_register_table_template.sql
grass/trunk/lib/temporal/SQL/map_tables_template.sql
grass/trunk/lib/temporal/SQL/raster3d_metadata_table.sql
grass/trunk/lib/temporal/SQL/raster_metadata_table.sql
grass/trunk/lib/temporal/SQL/stds_map_register_table_template.sql
grass/trunk/lib/temporal/SQL/stds_tables_template.sql
grass/trunk/lib/temporal/SQL/str3ds_metadata_table.sql
grass/trunk/lib/temporal/SQL/strds_metadata_table.sql
grass/trunk/lib/temporal/SQL/stvds_metadata_table.sql
grass/trunk/lib/temporal/SQL/vector_metadata_table.sql
grass/trunk/lib/temporal/SQL/vector_views.sql
Log:
Code cleanup. Added index for faster sqlite access.
Modified: grass/trunk/lib/temporal/SQL/map_stds_register_table_template.sql
===================================================================
--- grass/trunk/lib/temporal/SQL/map_stds_register_table_template.sql 2013-08-17 21:17:16 UTC (rev 57461)
+++ grass/trunk/lib/temporal/SQL/map_stds_register_table_template.sql 2013-08-17 22:15:59 UTC (rev 57462)
@@ -19,20 +19,5 @@
-- This table stores the names of the space-time datasets in which this map is registered
CREATE TABLE TABLE_NAME_STDS_register (
id VARCHAR NOT NULL, -- This column is a primary foreign key storing the STDS names
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES STDS_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES STDS_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
-
---CREATE TRIGGER TABLE_NAME_STDS_register_insert AFTER INSERT ON TABLE_NAME_STDS_register
--- BEGIN
--- UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE GRASS_MAP_base.id = 'MAP_ID';
--- UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE GRASS_MAP_base.id = 'MAP_ID';
--- END;
-
---CREATE TRIGGER TABLE_NAME_STDS_register_delete AFTER DELETE ON TABLE_NAME_STDS_register
--- BEGIN
--- UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE GRASS_MAP_base.id = 'MAP_ID';
--- UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE GRASS_MAP_base.id = 'MAP_ID';
--- END;
-
-
Modified: grass/trunk/lib/temporal/SQL/map_tables_template.sql
===================================================================
--- grass/trunk/lib/temporal/SQL/map_tables_template.sql 2013-08-17 21:17:16 UTC (rev 57461)
+++ grass/trunk/lib/temporal/SQL/map_tables_template.sql 2013-08-17 22:15:59 UTC (rev 57462)
@@ -28,28 +28,28 @@
PRIMARY KEY (id)
);
+CREATE INDEX GRASS_MAP_base_index ON GRASS_MAP_base (id);
+
-- Relative valid time interval with start and end time
CREATE TABLE GRASS_MAP_relative_time (
id VARCHAR NOT NULL, -- The id (PFK) is the unique identifier for all tables, it is based on name and mapset (name at mapset) and is used as primary foreign key
start_time INTEGER, -- The relative valid start time in
end_time INTEGER, -- The relative valid end time in
unit VARCHAR, -- The relative time unit, available are "years, months, days, minutes, seconds"
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES GRASS_MAP_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES GRASS_MAP_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
-CREATE INDEX GRASS_MAP_relative_time_index ON GRASS_MAP_relative_time (start_time, end_time);
+CREATE INDEX GRASS_MAP_relative_time_index ON GRASS_MAP_relative_time (id, start_time, end_time);
CREATE TABLE GRASS_MAP_absolute_time (
id VARCHAR NOT NULL, -- The id (PFK) is the unique identifier for all tables, it is based on name and mapset (name at mapset) and is used as primary foreign key
start_time TIMESTAMP, -- Start of the valid time, can be NULL if no time information is available
end_time TIMESTAMP, -- End of the valid time, can be NULL if no time information is available or valid time is a single point in time
timezone VARCHAR, -- The timezone of the valid time stored as string. This is currently not in use. Instead the timezone is set in the datetime strings
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES GRASS_MAP_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES GRASS_MAP_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
-CREATE INDEX GRASS_MAP_absolute_time_index ON GRASS_MAP_absolute_time (start_time, end_time);
+CREATE INDEX GRASS_MAP_absolute_time_index ON GRASS_MAP_absolute_time (id, start_time, end_time);
-- The spatial extent of a raster map
@@ -63,27 +63,7 @@
top DOUBLE PRECISION NOT NULL,
bottom DOUBLE PRECISION NOT NULL,
proj VARCHAR,
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES GRASS_MAP_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES GRASS_MAP_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
--- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated
-
---CREATE TRIGGER update_GRASS_MAP_absolute_time AFTER UPDATE ON GRASS_MAP_absolute_time
--- BEGIN
--- UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
-
---CREATE TRIGGER update_GRASS_MAP_relative_time AFTER UPDATE ON GRASS_MAP_relative_time
--- BEGIN
--- UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
-
-
---CREATE TRIGGER update_GRASS_MAP_spatial_extent AFTER UPDATE ON GRASS_MAP_spatial_extent
--- BEGIN
--- UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
+CREATE INDEX GRASS_MAP_spatial_extent_index ON GRASS_MAP_spatial_extent (id);
Modified: grass/trunk/lib/temporal/SQL/raster3d_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/SQL/raster3d_metadata_table.sql 2013-08-17 21:17:16 UTC (rev 57461)
+++ grass/trunk/lib/temporal/SQL/raster3d_metadata_table.sql 2013-08-17 22:15:59 UTC (rev 57462)
@@ -22,14 +22,8 @@
tbres DOUBLE PRECISION NOT NULL,
min DOUBLE PRECISION,
max DOUBLE PRECISION,
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES raster3d_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES raster3d_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
--- Create a trigger to update the modification time and revision number in case the metadata have been updated
+CREATE INDEX raster3d_metadata_index ON raster3d_metadata (id);
---CREATE TRIGGER update_raster3d_metadata AFTER UPDATE ON raster3d_metadata
--- BEGIN
--- UPDATE raster3d_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE raster3d_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
Modified: grass/trunk/lib/temporal/SQL/raster_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/SQL/raster_metadata_table.sql 2013-08-17 21:17:16 UTC (rev 57461)
+++ grass/trunk/lib/temporal/SQL/raster_metadata_table.sql 2013-08-17 22:15:59 UTC (rev 57462)
@@ -20,15 +20,7 @@
ewres DOUBLE PRECISION NOT NULL,
min DOUBLE PRECISION,
max DOUBLE PRECISION,
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES raster_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES raster_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
--- Create a trigger to update the modification time and revision number in case the metadata have been updated
--- Uncommented due to performance issues
---CREATE TRIGGER update_raster_metadata AFTER UPDATE ON raster_metadata
--- BEGIN
--- UPDATE raster_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE raster_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
-
+CREATE INDEX raster_metadata_index ON raster_metadata (id);
Modified: grass/trunk/lib/temporal/SQL/stds_map_register_table_template.sql
===================================================================
--- grass/trunk/lib/temporal/SQL/stds_map_register_table_template.sql 2013-08-17 21:17:16 UTC (rev 57461)
+++ grass/trunk/lib/temporal/SQL/stds_map_register_table_template.sql 2013-08-17 22:15:59 UTC (rev 57462)
@@ -17,113 +17,7 @@
-- This table stores the.ids of the GRASS_MAP maps registered in the current spacetime GRASS_MAP table
CREATE TABLE SPACETIME_NAME_GRASS_MAP_register (
id VARCHAR NOT NULL, -- This colum is a primary foreign key storing the registered GRASS_MAP map.ids
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES GRASS_MAP_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES GRASS_MAP_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
--- Triggers are disabled due to huge performance issues
---CREATE TRIGGER SPACETIME_NAME_GRASS_MAP_register_insert_trigger AFTER INSERT ON SPACETIME_NAME_GRASS_MAP_register
--- BEGIN
--- UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_base SET revision = (revision + 1) WHERE id = 'SPACETIME_ID';
--- -- Number of registered maps
--- UPDATE STDS_metadata SET number_of_maps =
--- (SELECT count(id) FROM SPACETIME_NAME_GRASS_MAP_register)
--- WHERE id = 'SPACETIME_ID';
--- -- Update the temporal extent
--- UPDATE STDS_absolute_time SET start_time =
--- (SELECT min(start_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_absolute_time SET end_time =
--- (SELECT max(end_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
-
--- UPDATE STDS_relative_time SET start_time =
--- (SELECT min(start_time) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_relative_time SET end_time =
--- (SELECT max(end_time) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- -- Update the spatial extent
--- UPDATE STDS_spatial_extent SET north =
--- (SELECT max(north) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET south =
--- (SELECT min(south) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET east =
--- (SELECT max(east) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET west =
--- (SELECT min(west) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET top =
--- (SELECT max(top) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET bottom =
--- (SELECT min(bottom) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET proj =
--- (SELECT min(proj) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- END;
---
---CREATE TRIGGER SPACETIME_NAME_GRASS_MAP_register_delete_trigger AFTER DELETE ON SPACETIME_NAME_GRASS_MAP_register
--- BEGIN
--- UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_base SET revision = (revision + 1) WHERE id = 'SPACETIME_ID';
--- -- Number of registered maps
--- UPDATE STDS_metadata SET number_of_maps =
--- (SELECT count(id) FROM SPACETIME_NAME_GRASS_MAP_register)
--- WHERE id = 'SPACETIME_ID';
--- -- Update the temporal extent
--- UPDATE STDS_absolute_time SET start_time =
--- (SELECT min(start_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_absolute_time SET end_time =
--- (SELECT max(end_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- -- Update the spatial extent
--- UPDATE STDS_spatial_extent SET north =
--- (SELECT max(north) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET south =
--- (SELECT min(south) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET east =
--- (SELECT max(east) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET west =
--- (SELECT min(west) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET top =
--- (SELECT max(top) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET bottom =
--- (SELECT min(bottom) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- UPDATE STDS_spatial_extent SET proj =
--- (SELECT min(proj) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
--- ) WHERE id = 'SPACETIME_ID';
--- END;
---
+CREATE INDEX SPACETIME_NAME_GRASS_MAP_register_index ON SPACETIME_NAME_GRASS_MAP_register (id);
Modified: grass/trunk/lib/temporal/SQL/stds_tables_template.sql
===================================================================
--- grass/trunk/lib/temporal/SQL/stds_tables_template.sql 2013-08-17 21:17:16 UTC (rev 57461)
+++ grass/trunk/lib/temporal/SQL/stds_tables_template.sql 2013-08-17 22:15:59 UTC (rev 57462)
@@ -30,8 +30,7 @@
granularity INTEGER, -- The granularity
unit VARCHAR, -- The relative time unit, available are "years, months, days, minutes, seconds"
map_time VARCHAR, -- The temporal type of the registered maps, may be interval, point or mixed
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES STDS_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES STDS_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE STDS_absolute_time (
@@ -41,8 +40,7 @@
granularity VARCHAR, -- The granularity "NNN seconds, NNN minutes, NNN hours, NNN days, NNN months, NNN years"
timezone VARCHAR, -- The timezone of the valid time stored as string. This is currently not in use. Instead the timezone is set in the datetime strings
map_time VARCHAR, -- The temporal type of the registered maps, may be interval, point or mixed
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES STDS_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES STDS_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE STDS_spatial_extent (
@@ -54,27 +52,5 @@
top DOUBLE PRECISION, -- The spatial top extent, derived from the registered maps
bottom DOUBLE PRECISION, -- The spatial bottom extent, derived from the registered maps
proj VARCHAR, -- The projection of the space time dataset (XY of LL)
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES STDS_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES STDS_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
-
--- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated
--- Uncommented due to performance issues
---CREATE TRIGGER update_STDS_abs_time AFTER UPDATE ON STDS_absolute_time
--- BEGIN
--- UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE STDS_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
-
---CREATE TRIGGER update_STDS_rel_time AFTER UPDATE ON STDS_relative_time
--- BEGIN
--- UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE STDS_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
-
---CREATE TRIGGER update_STDS_spatial_extent AFTER UPDATE ON STDS_spatial_extent
--- BEGIN
--- UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE STDS_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
-
Modified: grass/trunk/lib/temporal/SQL/str3ds_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/SQL/str3ds_metadata_table.sql 2013-08-17 21:17:16 UTC (rev 57461)
+++ grass/trunk/lib/temporal/SQL/str3ds_metadata_table.sql 2013-08-17 22:15:59 UTC (rev 57462)
@@ -23,14 +23,5 @@
title VARCHAR, -- Title of the space time 3D raster dataset
description VARCHAR, -- Detailed description of the space time 3D raster dataset
command VARCHAR, -- The command that was used to create the space time 3D raster dataset
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES str3ds_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES str3ds_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
-
--- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated
--- Uncommented due to performance issues
---CREATE TRIGGER update_str3ds_metadata AFTER UPDATE ON str3ds_metadata
--- BEGIN
--- UPDATE str3ds_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE str3ds_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
Modified: grass/trunk/lib/temporal/SQL/strds_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/SQL/strds_metadata_table.sql 2013-08-17 21:17:16 UTC (rev 57461)
+++ grass/trunk/lib/temporal/SQL/strds_metadata_table.sql 2013-08-17 22:15:59 UTC (rev 57462)
@@ -21,14 +21,5 @@
title VARCHAR, -- Title of the space-time raster dataset
description VARCHAR, -- Detailed description of the space-time raster dataset
command VARCHAR, -- The command that was used to create the space time raster dataset
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES strds_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES strds_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
-
--- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated
--- Uncommented due to performance issues
---CREATE TRIGGER update_strds_metadata AFTER UPDATE ON strds_metadata
--- BEGIN
--- UPDATE strds_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE strds_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
Modified: grass/trunk/lib/temporal/SQL/stvds_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/SQL/stvds_metadata_table.sql 2013-08-17 21:17:16 UTC (rev 57461)
+++ grass/trunk/lib/temporal/SQL/stvds_metadata_table.sql 2013-08-17 22:15:59 UTC (rev 57462)
@@ -25,14 +25,5 @@
islands INTEGER, -- The number of islands accumulated from all registered maps (topological information)
holes INTEGER, -- The number of holes accumulated from all registered maps (topological information)
volumes INTEGER, -- The number of volumes accumulated from all registered maps (topological information)
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES stvds_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES stvds_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
-
--- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated
--- Uncommented due to performance issues
---CREATE TRIGGER update_stvds_metadata AFTER UPDATE ON stvds_metadata
--- BEGIN
--- UPDATE stvds_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE stvds_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
Modified: grass/trunk/lib/temporal/SQL/vector_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/SQL/vector_metadata_table.sql 2013-08-17 21:17:16 UTC (rev 57461)
+++ grass/trunk/lib/temporal/SQL/vector_metadata_table.sql 2013-08-17 22:15:59 UTC (rev 57462)
@@ -25,14 +25,7 @@
islands INTEGER, -- The number of islands (topological information)
holes INTEGER, -- The number of holes (topological information)
volumes INTEGER, -- The number of volumes (topological information)
- PRIMARY KEY (id),
- FOREIGN KEY (id) REFERENCES vector_base (id) ON DELETE CASCADE
+ FOREIGN KEY (id) REFERENCES vector_base (id) ON DELETE CASCADE ON UPDATE CASCADE
);
--- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated
--- Uncommented due to performance issues
---CREATE TRIGGER update_vector_metadata AFTER UPDATE ON vector_metadata
--- BEGIN
--- UPDATE vector_base SET modification_time = datetime("NOW") WHERE id = old.id;
--- UPDATE vector_base SET revision = (revision + 1) WHERE id = old.id;
--- END;
+CREATE INDEX vector_metadata_index ON vector_metadata (id);
Modified: grass/trunk/lib/temporal/SQL/vector_views.sql
===================================================================
--- grass/trunk/lib/temporal/SQL/vector_views.sql 2013-08-17 21:17:16 UTC (rev 57461)
+++ grass/trunk/lib/temporal/SQL/vector_views.sql 2013-08-17 22:15:59 UTC (rev 57462)
@@ -10,8 +10,6 @@
A1.id, A1.mapset,
A1.name, A1.layer, A1.temporal_type,
A1.creation_time,
--- Uncommented due to performance issues
--- A1.modification_time, A1.revision,
A1.creator,
A2.start_time, A2.end_time, A2.timezone,
A3.north, A3.south, A3.east, A3.west, A3.bottom, A3.top, A3.proj,
@@ -26,9 +24,7 @@
CREATE VIEW vector_view_rel_time AS SELECT
A1.id, A1.mapset,
A1.name, A1.layer, A1.temporal_type,
- A1.creation_time,
--- Uncommented due to performance issues
--- A1.modification_time, A1.revision,
+ A1.creation_time,
A1.creator,
A2.start_time, A2.end_time,
A3.north, A3.south, A3.east, A3.west, A3.bottom, A3.top, A3.proj,
More information about the grass-commit
mailing list