From: Victor Huesca <victor.huesca@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH buildroot-test 3/4] web/schema.sql: add indexes on the database schema
Date: Fri, 21 Jun 2019 14:37:11 +0200 [thread overview]
Message-ID: <20190621123712.8060-4-victor.huesca@bootlin.com> (raw)
In-Reply-To: <20190621123712.8060-1-victor.huesca@bootlin.com>
Add indexes on the two columns of `symbol_per_result` to improve significantly
queries involving symbols (this is an over 80M rows table).
This table is heavily used to retrieve results matching a symbols and it is not
an option filter symbols without these indexes.
Also mark these same columns as foreign keys to ensure integrity of the
database.
Signed-off-by: Victor Huesca <victor.huesca@bootlin.com>
---
web/schema.sql | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/web/schema.sql b/web/schema.sql
index 65fd883..8b854a2 100644
--- a/web/schema.sql
+++ b/web/schema.sql
@@ -27,5 +27,10 @@ CREATE TABLE `symbol_per_result` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`result_id` int(11) NOT NULL DEFAULT '0',
`symbol_id` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_result_id` FOREIGN KEY (`result_id`) REFERENCES `results`(`id`),
+ CONSTRAINT `fk_symbol_id` FOREIGN KEY (`symbol_id`) REFERENCES `config_symbol`(`id`),
+ INDEX `ix_symbol_id`(`symbol_id`),
+ INDEX `ix_result_id`(`result_id`)
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
2.21.0
next prev parent reply other threads:[~2019-06-21 12:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 12:37 [Buildroot] [PATCH buildroot-test 0/4] allow results to be filtered by symbols Victor Huesca
2019-06-21 12:37 ` [Buildroot] [PATCH buildroot-test 1/4] web/{funcs, db}.inc.php: add support for symbols in sql query Victor Huesca
2019-06-21 12:37 ` [Buildroot] [PATCH buildroot-test 2/4] web/index.php: add support for symbols to be passed via GET Victor Huesca
2019-06-21 12:37 ` Victor Huesca [this message]
2019-06-21 12:37 ` [Buildroot] [PATCH buildroot-test 4/4] web/request.{js, php} and web/stylesheet.css: new page to ease seaching for specific results Victor Huesca
2019-07-08 8:17 ` [Buildroot] [PATCH buildroot-test v2 0/4] allow results to be filtered by symbols Victor Huesca
2019-07-08 8:17 ` [Buildroot] [PATCH buildroot-test v2 1/4] web/{funcs, db}.inc.php: add support for symbols in sql query Victor Huesca
2019-07-12 13:29 ` Thomas Petazzoni
2019-07-08 8:17 ` [Buildroot] [PATCH buildroot-test v2 2/4] web/index.php: add support for symbols to be passed via GET Victor Huesca
2019-07-12 13:37 ` Thomas Petazzoni
2019-07-08 8:17 ` [Buildroot] [PATCH buildroot-test v2 3/4] web/schema.sql: add indexes on the database schema Victor Huesca
2019-07-12 13:46 ` Thomas Petazzoni
2019-07-08 8:17 ` [Buildroot] [PATCH buildroot-test v2 4/4] web/request.{js, php} and web/stylesheet.css: new page to ease seaching for specific results Victor Huesca
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190621123712.8060-4-victor.huesca@bootlin.com \
--to=victor.huesca@bootlin.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox