From a354b1f864523e9def80aa1b3a561bce6bdb05ab Mon Sep 17 00:00:00 2001
From: Kelly Rauchenberger <fefferburbia@gmail.com>
Date: Mon, 13 Feb 2017 10:54:41 -0500
Subject: Tweaked database indexes

`rhymes_with` now also contains `prerhyme` so that rhyming joins can be
convering. `notions_lemmas` and `lemmas_notions` have been created so as
to faciliate "jumping" over `words` when it's only needed as a
many-to-many through table. Because `notion_words` and `lemma_words` are
prefixes of these new indexes, they have been removed.
---
 generator/schema.sql | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'generator/schema.sql')

diff --git a/generator/schema.sql b/generator/schema.sql
index 5b42d52..a49a853 100644
--- a/generator/schema.sql
+++ b/generator/schema.sql
@@ -92,8 +92,8 @@ CREATE TABLE `words` (
   `group_id` INTEGER
 );
 
-CREATE INDEX `notion_words` ON `words`(`notion_id`);
-CREATE INDEX `lemma_words` ON `words`(`lemma_id`);
+CREATE INDEX `notions_lemmas` ON `words`(`notion_id`,`lemma_id`);
+CREATE INDEX `lemmas_notions` ON `words`(`lemma_id`,`notion_id`);
 CREATE INDEX `group_words` ON `words`(`group_id`);
 
 CREATE TABLE `antonymy` (
@@ -178,7 +178,7 @@ CREATE TABLE `pronunciations` (
   `stress` VARCHAR(64) NOT NULL
 );
 
-CREATE INDEX `rhymes_with` ON `pronunciations`(`rhyme`);
+CREATE INDEX `rhymes_with` ON `pronunciations`(`rhyme`,`prerhyme`);
 
 CREATE TABLE `forms_pronunciations` (
   `form_id` INTEGER NOT NULL,
-- 
cgit 1.4.1

