diff --git a/sql/schema_mysql.sql b/sql/schema_mysql.sql index 9e66a98..1238a94 100644 --- a/sql/schema_mysql.sql +++ b/sql/schema_mysql.sql @@ -22,3 +22,5 @@ CREATE TABLE `locations` ( ) DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT; CREATE INDEX `idx_getmarkers` ON `locations` (`epoch` DESC, `accuracy`, `altitude`); + +CREATE INDEX `idx_epochexisting` ON `locations` (`tracker_id`, `epoch` DESC); diff --git a/sql/schema_sqlite.sql b/sql/schema_sqlite.sql index 1b65a0c..64f4d14 100644 --- a/sql/schema_sqlite.sql +++ b/sql/schema_sqlite.sql @@ -28,3 +28,8 @@ CREATE INDEX "idx_getmarkers" ON "locations" ( "accuracy", "altitude" ); + +CREATE INDEX "idx_epochexisting" ON "locations" ( + "tracker_id", + "epoch" DESC +);