Create index on the logs table on time instead of on kind.
That way we can search through all logs in constant time instead of having to perform a full table scan.
This commit is contained in:
parent
54ad65c744
commit
d00a5f737c
|
@ -79,7 +79,7 @@ def create_log_db():
|
||||||
subject TEXT
|
subject TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX idx_logs_jid_id_kind ON logs (jid_id, kind);
|
CREATE INDEX idx_logs_jid_id_time ON logs (jid_id, time DESC);
|
||||||
|
|
||||||
CREATE TABLE caps_cache (
|
CREATE TABLE caps_cache (
|
||||||
hash_method TEXT,
|
hash_method TEXT,
|
||||||
|
|
|
@ -27,7 +27,7 @@ docdir = '../'
|
||||||
basedir = '../'
|
basedir = '../'
|
||||||
localedir = '../po'
|
localedir = '../po'
|
||||||
|
|
||||||
version = '0.13.10.0-dev'
|
version = '0.13.10.1-dev'
|
||||||
|
|
||||||
import sys, os.path
|
import sys, os.path
|
||||||
for base in ('.', 'common'):
|
for base in ('.', 'common'):
|
||||||
|
|
|
@ -214,6 +214,8 @@ class OptionsParser:
|
||||||
self.update_config_to_01258()
|
self.update_config_to_01258()
|
||||||
if old < [0, 13, 10, 0] and new >= [0, 13, 10, 0]:
|
if old < [0, 13, 10, 0] and new >= [0, 13, 10, 0]:
|
||||||
self.update_config_to_013100()
|
self.update_config_to_013100()
|
||||||
|
if old < [0, 13, 10, 1] and new >= [0, 13, 10, 1]:
|
||||||
|
self.update_config_to_013101()
|
||||||
|
|
||||||
gajim.logger.init_vars()
|
gajim.logger.init_vars()
|
||||||
gajim.config.set('version', new_version)
|
gajim.config.set('version', new_version)
|
||||||
|
@ -857,4 +859,25 @@ class OptionsParser:
|
||||||
con.close()
|
con.close()
|
||||||
gajim.config.set('version', '0.13.10.0')
|
gajim.config.set('version', '0.13.10.0')
|
||||||
|
|
||||||
|
def update_config_to_013101(self):
|
||||||
|
back = os.getcwd()
|
||||||
|
os.chdir(logger.LOG_DB_FOLDER)
|
||||||
|
con = sqlite.connect(logger.LOG_DB_FILE)
|
||||||
|
os.chdir(back)
|
||||||
|
cur = con.cursor()
|
||||||
|
try:
|
||||||
|
cur.executescript(
|
||||||
|
'''
|
||||||
|
DROP INDEX IF EXISTS idx_logs_jid_id_kind;
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS
|
||||||
|
idx_logs_jid_id_time ON logs (jid_id, time DESC);
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
con.commit()
|
||||||
|
except sqlite.OperationalError:
|
||||||
|
pass
|
||||||
|
con.close()
|
||||||
|
gajim.config.set('version', '0.13.10.1')
|
||||||
|
|
||||||
# vim: se ts=3:
|
# vim: se ts=3:
|
||||||
|
|
Loading…
Reference in New Issue