Skip Menu |

This queue is for tickets about the SQLite_File CPAN distribution.

Report information
The Basics
Id: 122742
Status: resolved
Priority: 0/
Queue: SQLite_File

People
Owner: maj.fortinbras [...] gmail.com
Requestors: justincase [...] yopmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Hash type should use an index
When tying to a simple hash like in the synopsis: tie(%db, 'SQLite_File', 'my.db'); The resulting sqlite file does not create an index on the `id` field, so lookups on the hash table will be O(n), instead of the expected O(1). It looks like the index is only created for the BTREE (BINARY) type.
On Mon Aug 07 22:36:06 2017, justincase wrote: Show quoted text
> When tying to a simple hash like in the synopsis: > > tie(%db, 'SQLite_File', 'my.db'); > > The resulting sqlite file does not create an index on the `id` field, > so lookups on the hash table will be O(n), instead of the expected > O(1). It looks like the index is only created for the BTREE (BINARY) > type.
it's almost a year now and still no fix even though it's just a single line. i guess we're suppose to conclude this is not maintained. in case you change your mind: diff --git a/lib/SQLite_File.pm b/lib/SQLite_File.pm index 9776842..af4eb9e 100755 --- a/lib/SQLite_File.pm +++ b/lib/SQLite_File.pm @@ -352,6 +352,7 @@ END }; $_ eq 'HASH' && do { $self->dbh->do("CREATE TABLE IF NOT EXISTS hash ".$hash_tbl->()); + $self->dbh->do($create_idx); last; }; $_ eq 'RECNO' && do {