Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue3783] dbm.sqlite proof of concept

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 19, 2009, 8:56 AM

Post #1 of 3 (201 views)
Permalink
[issue3783] dbm.sqlite proof of concept

Runar Tenfjord <runar.tenfjord [at] gmail> added the comment:

By utilizing triggers on inserts and deletes it is possible to
keep track of the size and speed up __len__ by 10 x.

SQL:

CREATE TABLE IF NOT EXISTS info
(key TEXT UNIQUE NOT NULL,
value INTEGER NOT NULL);

INSERT OR IGNORE INTO info (key,value) VALUES ('size',0);

CREATE TABLE IF NOT EXISTS shelf
(key TEXT UNIQUE NOT NULL,
value TEXT NOT NULL);

CREATE TRIGGER IF NOT EXISTS insert_shelf
AFTER INSERT ON shelf
BEGIN
UPDATE info SET value = value + 1 WHERE key = 'size';
END;

CREATE TRIGGER IF NOT EXISTS delete_shelf
AFTER DELETE ON shelf
BEGIN
UPDATE info SET value = value - 1 WHERE key = 'size';
END;

On my laptop this increase the speed of 'len' about 10x

I have a slightly modified version of dbsqlite.py for
running on python 2.5 utilizing the triggers for
keep track of the size:

http://dpaste.com/hold/122439/

----------
nosy: +rute

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3783>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 19, 2009, 8:59 AM

Post #2 of 3 (182 views)
Permalink
[issue3783] dbm.sqlite proof of concept [In reply to]

Changes by Antoine Pitrou <pitrou [at] free>:


----------
stage: -> needs patch
versions: +Python 3.2 -Python 3.1

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3783>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 29, 2009, 4:47 AM

Post #3 of 3 (149 views)
Permalink
[issue3783] dbm.sqlite proof of concept [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

It would be nice to try to advance this at PyCon, or at another time.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3783>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.