Move container_id to the end of the groups index

I think this will speed up the collisions view.

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent d8fd55f5cc
commit 4deabceb9e
  1. 8
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt
  2. 4
      archive/src/main/resources/org/openrs2/archive/migrations/V1__init.sql

@ -552,7 +552,7 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
INSERT INTO groups (archive_id, group_id, container_id, version, version_truncated) INSERT INTO groups (archive_id, group_id, version, version_truncated, container_id)
VALUES (?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?)
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
@ -560,9 +560,9 @@ public class CacheImporter @Inject constructor(
for ((i, group) in groups.withIndex()) { for ((i, group) in groups.withIndex()) {
stmt.setInt(1, group.archive) stmt.setInt(1, group.archive)
stmt.setInt(2, group.group) stmt.setInt(2, group.group)
stmt.setLong(3, containerIds[i]) stmt.setInt(3, group.version)
stmt.setInt(4, group.version) stmt.setBoolean(4, group.versionTruncated)
stmt.setBoolean(5, group.versionTruncated) stmt.setLong(5, containerIds[i])
stmt.addBatch() stmt.addBatch()
} }

@ -58,10 +58,10 @@ VALUES (NULL, NULL);
CREATE TABLE groups ( CREATE TABLE groups (
archive_id uint1 NOT NULL, archive_id uint1 NOT NULL,
group_id INTEGER NOT NULL, group_id INTEGER NOT NULL,
container_id BIGINT NOT NULL REFERENCES containers (id),
version INTEGER NOT NULL, version INTEGER NOT NULL,
version_truncated BOOLEAN NOT NULL, version_truncated BOOLEAN NOT NULL,
PRIMARY KEY (archive_id, group_id, container_id, version, version_truncated) container_id BIGINT NOT NULL REFERENCES containers (id),
PRIMARY KEY (archive_id, group_id, version, version_truncated, container_id)
); );
CREATE TABLE indexes ( CREATE TABLE indexes (

Loading…
Cancel
Save