- Rewritten messages caching (merged devel-mcache branch):

Indexes are stored in a separate table, so there's no need to store all messages in a folder
  Added threads data caching
  Flags are stored separately, so flag change doesn't cause DELETE+INSERT, just UPDATE
- Partial QRESYNC support
- Improved FETCH response handling
- Improvements in response tokenization method
This commit is contained in:
alecpl
2011-09-07 11:07:03 +00:00
parent b104e39f34
commit 80152b333c
17 changed files with 2178 additions and 1265 deletions

View File

@@ -1,7 +1,7 @@
-- Roundcube Webmail initial database structure
--
-- Table structure for table `cache`
-- Table structure for table cache
--
CREATE TABLE cache (
@@ -9,7 +9,7 @@ CREATE TABLE cache (
user_id integer NOT NULL default 0,
cache_key varchar(128) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
data longtext NOT NULL
data text NOT NULL
);
CREATE INDEX ix_cache_user_cache_key ON cache(user_id, cache_key);
@@ -121,34 +121,6 @@ CREATE INDEX ix_session_changed ON session (changed);
-- --------------------------------------------------------
--
-- Table structure for table messages
--
CREATE TABLE messages (
message_id integer NOT NULL PRIMARY KEY,
user_id integer NOT NULL default '0',
del tinyint NOT NULL default '0',
cache_key varchar(128) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
idx integer NOT NULL default '0',
uid integer NOT NULL default '0',
subject varchar(255) NOT NULL default '',
"from" varchar(255) NOT NULL default '',
"to" varchar(255) NOT NULL default '',
"cc" varchar(255) NOT NULL default '',
"date" datetime NOT NULL default '0000-00-00 00:00:00',
size integer NOT NULL default '0',
headers text NOT NULL,
structure text
);
CREATE UNIQUE INDEX ix_messages_user_cache_uid ON messages (user_id,cache_key,uid);
CREATE INDEX ix_messages_index ON messages (user_id,cache_key,idx);
CREATE INDEX ix_messages_created ON messages (created);
-- --------------------------------------------------------
--
-- Table structure for table dictionary
--
@@ -176,3 +148,58 @@ CREATE TABLE searches (
);
CREATE UNIQUE INDEX ix_searches_user_type_name (user_id, type, name);
-- --------------------------------------------------------
--
-- Table structure for table cache_index
--
CREATE TABLE cache_index (
user_id integer NOT NULL,
mailbox varchar(255) NOT NULL,
changed datetime NOT NULL default '0000-00-00 00:00:00',
data text NOT NULL,
PRIMARY KEY (user_id, mailbox)
);
CREATE INDEX ix_cache_index_changed ON cache_index (changed);
-- --------------------------------------------------------
--
-- Table structure for table cache_thread
--
CREATE TABLE cache_thread (
user_id integer NOT NULL,
mailbox varchar(255) NOT NULL,
changed datetime NOT NULL default '0000-00-00 00:00:00',
data text NOT NULL,
PRIMARY KEY (user_id, mailbox)
);
CREATE INDEX ix_cache_thread_changed ON cache_thread (changed);
-- --------------------------------------------------------
--
-- Table structure for table cache_messages
--
CREATE TABLE cache_messages (
user_id integer NOT NULL,
mailbox varchar(255) NOT NULL,
uid integer NOT NULL,
changed datetime NOT NULL default '0000-00-00 00:00:00',
data text NOT NULL,
seen smallint NOT NULL DEFAULT '0',
deleted smallint NOT NULL DEFAULT '0',
answered smallint NOT NULL DEFAULT '0',
forwarded smallint NOT NULL DEFAULT '0',
flagged smallint NOT NULL DEFAULT '0',
mdnsent smallint NOT NULL DEFAULT '0',
PRIMARY KEY (user_id, mailbox, uid)
);
CREATE INDEX ix_cache_messages_changed ON cache_messages (changed);