mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
sql/*: Add username to peer indexes
The username is available for all MAM queries in question, and adding it to the indexes can improve the lookup performance significantly.
This commit is contained in:
parent
5bf753fd2d
commit
f7566bd00e
@ -109,9 +109,9 @@ CREATE TABLE archive (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX i_archive_sh_username_timestamp ON archive (server_host, username, timestamp);
|
CREATE INDEX i_archive_sh_username_timestamp ON archive (server_host, username, timestamp);
|
||||||
|
CREATE INDEX i_archive_sh_username_peer ON archive (server_host, username, peer);
|
||||||
|
CREATE INDEX i_archive_sh_username_bare_peer ON archive (server_host, username, bare_peer);
|
||||||
CREATE INDEX i_archive_sh_timestamp ON archive (server_host, timestamp);
|
CREATE INDEX i_archive_sh_timestamp ON archive (server_host, timestamp);
|
||||||
CREATE INDEX i_archive_sh_peer ON archive (server_host, peer);
|
|
||||||
CREATE INDEX i_archive_sh_bare_peer ON archive (server_host, bare_peer);
|
|
||||||
|
|
||||||
CREATE TABLE archive_prefs (
|
CREATE TABLE archive_prefs (
|
||||||
username text NOT NULL,
|
username text NOT NULL,
|
||||||
|
@ -98,9 +98,9 @@ CREATE TABLE archive (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX i_username_timestamp ON archive(username, timestamp);
|
CREATE INDEX i_username_timestamp ON archive(username, timestamp);
|
||||||
|
CREATE INDEX i_archive_username_peer ON archive (username, peer);
|
||||||
|
CREATE INDEX i_archive_username_bare_peer ON archive (username, bare_peer);
|
||||||
CREATE INDEX i_timestamp ON archive(timestamp);
|
CREATE INDEX i_timestamp ON archive(timestamp);
|
||||||
CREATE INDEX i_peer ON archive(peer);
|
|
||||||
CREATE INDEX i_bare_peer ON archive(bare_peer);
|
|
||||||
|
|
||||||
CREATE TABLE archive_prefs (
|
CREATE TABLE archive_prefs (
|
||||||
username text NOT NULL PRIMARY KEY,
|
username text NOT NULL PRIMARY KEY,
|
||||||
|
@ -41,15 +41,15 @@ CREATE TABLE [dbo].[archive] (
|
|||||||
CREATE INDEX [archive_username_timestamp] ON [archive] (username, timestamp)
|
CREATE INDEX [archive_username_timestamp] ON [archive] (username, timestamp)
|
||||||
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
|
||||||
|
|
||||||
|
CREATE INDEX [archive_username_peer] ON [archive] (username, peer)
|
||||||
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
|
||||||
|
|
||||||
|
CREATE INDEX [archive_username_bare_peer] ON [archive] (username, bare_peer)
|
||||||
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
|
||||||
|
|
||||||
CREATE INDEX [archive_timestamp] ON [archive] (timestamp)
|
CREATE INDEX [archive_timestamp] ON [archive] (timestamp)
|
||||||
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
|
||||||
|
|
||||||
CREATE INDEX [archive_peer] ON [archive] (peer)
|
|
||||||
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
|
|
||||||
|
|
||||||
CREATE INDEX [archive_bare_peer] ON [archive] (bare_peer)
|
|
||||||
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[archive_prefs] (
|
CREATE TABLE [dbo].[archive_prefs] (
|
||||||
[username] [varchar] (250) NOT NULL,
|
[username] [varchar] (250) NOT NULL,
|
||||||
[def] [text] NOT NULL,
|
[def] [text] NOT NULL,
|
||||||
|
@ -114,9 +114,9 @@ CREATE TABLE archive (
|
|||||||
|
|
||||||
CREATE FULLTEXT INDEX i_text ON archive(txt);
|
CREATE FULLTEXT INDEX i_text ON archive(txt);
|
||||||
CREATE INDEX i_archive_sh_username_timestamp USING BTREE ON archive(server_host(191), username, timestamp);
|
CREATE INDEX i_archive_sh_username_timestamp USING BTREE ON archive(server_host(191), username, timestamp);
|
||||||
|
CREATE INDEX i_archive_sh_username_peer USING BTREE ON archive(server_host(191), username, peer);
|
||||||
|
CREATE INDEX i_archive_sh_username_bare_peer USING BTREE ON archive(server_host(191), username, bare_peer);
|
||||||
CREATE INDEX i_archive_sh_timestamp USING BTREE ON archive(server_host(191), timestamp);
|
CREATE INDEX i_archive_sh_timestamp USING BTREE ON archive(server_host(191), timestamp);
|
||||||
CREATE INDEX i_archive_sh_peer USING BTREE ON archive(server_host(191), peer);
|
|
||||||
CREATE INDEX i_archive_sh_bare_peer USING BTREE ON archive(server_host(191), bare_peer);
|
|
||||||
|
|
||||||
CREATE TABLE archive_prefs (
|
CREATE TABLE archive_prefs (
|
||||||
username varchar(191) NOT NULL,
|
username varchar(191) NOT NULL,
|
||||||
|
@ -103,9 +103,9 @@ CREATE TABLE archive (
|
|||||||
|
|
||||||
CREATE FULLTEXT INDEX i_text ON archive(txt);
|
CREATE FULLTEXT INDEX i_text ON archive(txt);
|
||||||
CREATE INDEX i_username_timestamp USING BTREE ON archive(username, timestamp);
|
CREATE INDEX i_username_timestamp USING BTREE ON archive(username, timestamp);
|
||||||
|
CREATE INDEX i_username_peer USING BTREE ON archive(username, peer);
|
||||||
|
CREATE INDEX i_username_bare_peer USING BTREE ON archive(username, bare_peer);
|
||||||
CREATE INDEX i_timestamp USING BTREE ON archive(timestamp);
|
CREATE INDEX i_timestamp USING BTREE ON archive(timestamp);
|
||||||
CREATE INDEX i_peer USING BTREE ON archive(peer);
|
|
||||||
CREATE INDEX i_bare_peer USING BTREE ON archive(bare_peer);
|
|
||||||
|
|
||||||
CREATE TABLE archive_prefs (
|
CREATE TABLE archive_prefs (
|
||||||
username varchar(191) NOT NULL PRIMARY KEY,
|
username varchar(191) NOT NULL PRIMARY KEY,
|
||||||
|
@ -61,15 +61,14 @@
|
|||||||
-- ALTER TABLE spool ALTER COLUMN server_host DROP DEFAULT;
|
-- ALTER TABLE spool ALTER COLUMN server_host DROP DEFAULT;
|
||||||
|
|
||||||
-- ALTER TABLE archive ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
|
-- ALTER TABLE archive ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
|
||||||
-- DROP INDEX i_username;
|
|
||||||
-- DROP INDEX i_username_timestamp;
|
-- DROP INDEX i_username_timestamp;
|
||||||
|
-- DROP INDEX i_username_peer;
|
||||||
|
-- DROP INDEX i_username_bare_peer;
|
||||||
-- DROP INDEX i_timestamp;
|
-- DROP INDEX i_timestamp;
|
||||||
-- DROP INDEX i_peer;
|
|
||||||
-- DROP INDEX i_bare_peer;
|
|
||||||
-- CREATE INDEX i_archive_sh_username_timestamp ON archive USING btree (server_host, username, timestamp);
|
-- CREATE INDEX i_archive_sh_username_timestamp ON archive USING btree (server_host, username, timestamp);
|
||||||
|
-- CREATE INDEX i_archive_sh_username_peer ON archive USING btree (server_host, username, peer);
|
||||||
|
-- CREATE INDEX i_archive_sh_username_bare_peer ON archive USING btree (server_host, username, bare_peer);
|
||||||
-- CREATE INDEX i_archive_sh_timestamp ON archive USING btree (server_host, timestamp);
|
-- CREATE INDEX i_archive_sh_timestamp ON archive USING btree (server_host, timestamp);
|
||||||
-- CREATE INDEX i_archive_sh_peer ON archive USING btree (server_host, peer);
|
|
||||||
-- CREATE INDEX i_archive_sh_bare_peer ON archive USING btree (server_host, bare_peer);
|
|
||||||
-- ALTER TABLE archive ALTER COLUMN server_host DROP DEFAULT;
|
-- ALTER TABLE archive ALTER COLUMN server_host DROP DEFAULT;
|
||||||
|
|
||||||
-- ALTER TABLE archive_prefs ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
|
-- ALTER TABLE archive_prefs ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
|
||||||
@ -265,9 +264,9 @@ CREATE TABLE archive (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX i_archive_sh_username_timestamp ON archive USING btree (server_host, username, timestamp);
|
CREATE INDEX i_archive_sh_username_timestamp ON archive USING btree (server_host, username, timestamp);
|
||||||
|
CREATE INDEX i_archive_sh_username_peer ON archive USING btree (server_host, username, peer);
|
||||||
|
CREATE INDEX i_archive_sh_username_bare_peer ON archive USING btree (server_host, username, bare_peer);
|
||||||
CREATE INDEX i_archive_sh_timestamp ON archive USING btree (server_host, timestamp);
|
CREATE INDEX i_archive_sh_timestamp ON archive USING btree (server_host, timestamp);
|
||||||
CREATE INDEX i_archive_sh_peer ON archive USING btree (server_host, peer);
|
|
||||||
CREATE INDEX i_archive_sh_bare_peer ON archive USING btree (server_host, bare_peer);
|
|
||||||
|
|
||||||
CREATE TABLE archive_prefs (
|
CREATE TABLE archive_prefs (
|
||||||
username text NOT NULL,
|
username text NOT NULL,
|
||||||
|
@ -102,9 +102,9 @@ CREATE TABLE archive (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX i_username_timestamp ON archive USING btree (username, timestamp);
|
CREATE INDEX i_username_timestamp ON archive USING btree (username, timestamp);
|
||||||
|
CREATE INDEX i_username_peer ON archive USING btree (username, peer);
|
||||||
|
CREATE INDEX i_username_bare_peer ON archive USING btree (username, bare_peer);
|
||||||
CREATE INDEX i_timestamp ON archive USING btree (timestamp);
|
CREATE INDEX i_timestamp ON archive USING btree (timestamp);
|
||||||
CREATE INDEX i_peer ON archive USING btree (peer);
|
|
||||||
CREATE INDEX i_bare_peer ON archive USING btree (bare_peer);
|
|
||||||
|
|
||||||
CREATE TABLE archive_prefs (
|
CREATE TABLE archive_prefs (
|
||||||
username text NOT NULL PRIMARY KEY,
|
username text NOT NULL PRIMARY KEY,
|
||||||
|
Loading…
Reference in New Issue
Block a user