Re: [sqlite] Data optimization with GLOB, virtual deletes

2010-04-18 Thread Simon Slavin
On 18 Apr 2010, at 7:08pm, Mike Goins wrote: >> Also, I don't recall your saying whether a single composite index was faster >> than separate indexes? Is it? >> >> Regards >> Tim Romano > > Interesting suggestion. Separate indexes look to be slightly faster > than the composite.Separate i

Re: [sqlite] Data optimization with GLOB, virtual deletes

2010-04-18 Thread Mike Goins
> Just guessing, but column 'path' probably has greater cardinality than > column 'extension'. What happens if you reverse the order of these columns > in the index? > i.e. (basename, path, extension, deleted) (deleted, basename, extension, path) This order actually provides the most to least sig

Re: [sqlite] Data optimization with GLOB, virtual deletes

2010-04-17 Thread Tim Romano
Just guessing, but column 'path' probably has greater cardinality than column 'extension'. What happens if you reverse the order of these columns in the index? i.e. (basename, path, extension, deleted) Also, I don't recall your saying whether a single composite index was faster than separate index

Re: [sqlite] Data optimization with GLOB, virtual deletes

2010-04-16 Thread Simon Slavin
On 16 Apr 2010, at 1:17pm, Mike Goins wrote: > Table structure: > CREATE TABLE tb_file (tb_file_key INTEGER NOT NULL PRIMARY KEY > AUTOINCREMENT , basename TEXT, extension TEXT, path TEXT, deleted > INTEGER default 0 ); > > Index: > CREATE INDEX fullpath_idx on tb_file (basename, extension, path

Re: [sqlite] Data optimization with GLOB, virtual deletes

2010-04-16 Thread Mike Goins
On Fri, Apr 16, 2010 at 8:17 AM, Mike Goins wrote: > Query: > SELECT tb_file_key, basename, extension, path FROM tb_file WHERE >  basename GLOB 'a*' AND  extension GLOB 'b*' AND path GLOB 'c*' AND > deleted = 0 ORDER BY tb_file_key DESC; Apologies for responding to my own post (digest subscriber

[sqlite] Data optimization with GLOB, virtual deletes

2010-04-16 Thread Mike Goins
Sorry, this may look a bit familiar. Table structure: CREATE TABLE tb_file (tb_file_key INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT , basename TEXT, extension TEXT, path TEXT, deleted INTEGER default 0 ); Index: CREATE INDEX fullpath_idx on tb_file (basename, extension, path, deleted); Example in