From 93f5bd7dedb6260ae85942277b96d81e9ecb1295 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Wed, 13 May 2026 22:12:46 +0000 Subject: [PATCH] Index SIGHTINGS --- db/schemas/sokwedb/indexes/Makefile | 2 +- .../sokwedb/indexes/create/sightings.m4 | 37 +++++++++++++++++++ db/schemas/sokwedb/indexes/drop/sightings.m4 | 30 +++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 db/schemas/sokwedb/indexes/create/sightings.m4 create mode 100644 db/schemas/sokwedb/indexes/drop/sightings.m4 diff --git a/db/schemas/sokwedb/indexes/Makefile b/db/schemas/sokwedb/indexes/Makefile index 29bc6a5..d06a95f 100644 --- a/db/schemas/sokwedb/indexes/Makefile +++ b/db/schemas/sokwedb/indexes/Makefile @@ -21,7 +21,7 @@ # This is not really important but is needed for other types of db objects. ORDER := biography_data biography_log comm_membs comm_memb_log \ follows follow_observers follow_studies events roles arrivals \ - estrus_sources estrus_states aggression_event_log + estrus_sources estrus_states aggression_event_log sightings ## ## CAUTION: This Makefile is not designed to be run directly. It is normally diff --git a/db/schemas/sokwedb/indexes/create/sightings.m4 b/db/schemas/sokwedb/indexes/create/sightings.m4 new file mode 100644 index 0000000..67b7451 --- /dev/null +++ b/db/schemas/sokwedb/indexes/create/sightings.m4 @@ -0,0 +1,37 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`indexmacros.m4')dnl + +CREATE UNIQUE INDEX IF NOT EXISTS sightings_date_animid ON sightings + (date, animid); + +CREATE INDEX IF NOT EXISTS sightings_animid ON sightings + (animid); +-- Don't index date, we already have a date/animid pair +CREATE INDEX IF NOT EXISTS sightings_commid ON sightings + (commid); +-- An index on source is less useful, but be profligate +-- and don't worry about write performance or disk space. +CREATE INDEX IF NOT EXISTS sightings_source ON sightings + (source); + + diff --git a/db/schemas/sokwedb/indexes/drop/sightings.m4 b/db/schemas/sokwedb/indexes/drop/sightings.m4 new file mode 100644 index 0000000..815578c --- /dev/null +++ b/db/schemas/sokwedb/indexes/drop/sightings.m4 @@ -0,0 +1,30 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`indexmacros.m4')dnl + +DROP INDEX IF EXISTS sightings_date_animid; + +DROP INDEX IF EXISTS sightings_animid; +DROP INDEX IF EXISTS sightings_commid; +DROP INDEX IF EXISTS sightings_source; + + -- 2.34.1