[sqlite] number of term occurances in fts3

2008-12-08 Thread Jos van den Oever
Hi all, Can one retrieve the number of times a certain term occurs in an fts table? This can be useful for autocompletion comboboxes. An example query could look like this: select term, count(term) c from myfts3table where myfts3table match 'h*'; term|c hi|10 hello|20 The snippet function is

[sqlite] extremely slow join on an fts3 table

2008-12-03 Thread Jos van den Oever
Hi all, Doing a join on a fts3 table can be very slow. I'm using these tables: CREATE TABLE general ( ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ... ); CREATE VIRTUAL TABLE general_text using fts3 ( ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, a TEXT, b TEXT, c TEXT, d TEXT,

Re: [sqlite] query optimization for inner table join

2008-12-02 Thread Jos van den Oever
2008/12/2 Igor Tandetnik <[EMAIL PROTECTED]>: > You could also try something more straightforward: > > select distinct n from map m1 where >exists (select 1 from map m2 where m1.n=m2.n and m2.m=3) and >exists (select 1 from map m2 where m1.n=m2.n and m2.m=5) and >not exists (select 1

Re: [sqlite] query optimization for inner table join

2008-12-01 Thread Jos van den Oever
2008/12/1 Igor Tandetnik <[EMAIL PROTECTED]>: > Try this: > > select n from map > group by n > having >count(case when m=3 then 1 else null end) != 0 and >count(case when m=5 then 1 else null end) != 0 and >count(case when m=7 then 1 else null end) = 0; > > Having an index on map(n)

[sqlite] query optimization for inner table join

2008-12-01 Thread Jos van den Oever
Hi all, I've trouble optimizing for an N:M mapping table. The schema of the table is this: CREATE TABLE map (n INTEGER NOT NULL, m INTEGER NOT NULL); I want to retrieve a list of n filtered on the presence of certain values of m, e.g. give me all n for which there is an m = 3 and m = 5, but no

Re: [sqlite] Is there always an index on ROWID?

2008-02-20 Thread Jos van den Oever
2008/2/21, Neville Franks <[EMAIL PROTECTED]>: > If I create a table with a Primary key on a TEXT clm, will there still > be an Index on the in-built ROWID clm. The reason for asking this is > that I need fast (indexed) lookup to rows by both ROWID and my TEXT > clm. According to the

[sqlite] bit operations in select statements

2008-02-20 Thread Jos van den Oever
Hi all, Is it possible to use logic operations on fields, in particular on integers and on fixed sized blobs (256 bits/32 bytes). I'd like to do queries like this: select key where number_of_bits_set(value) = 10; or select key where value & '01011'; What would be a good method of

[sqlite] SQLITE_OPEN_DELETEONCLOSE == SQLITE_READONLY

2008-02-19 Thread Jos van den Oever
Hi all, While playing around with sqlit3_open_v2, I was unpleasantly surprised to find that my (test) database was deleted after opening it. It turned out I was using sqlite3_open_v2("test.db", , SQLITE_READONLY, 0); instead of sqlite3_open_v2("test.db", , SQLITE_OPEN_READONLY, 0); Digging

Re: [sqlite] FTS2 Experiences?

2007-06-18 Thread Jos van den Oever
2007/6/18, Russell Leighton <[EMAIL PROTECTED]>: Could folks that have used fts2 in production apps/systems relate their experiences to the group? I would very much be interested in how folks are using it, how well it performs with large data and general impressions. I had a look at it for an

Re: [sqlite] Re : [sqlite] Soft search in database

2007-03-06 Thread Jos van den Oever
2007/3/6, Pierre Aubert <[EMAIL PROTECTED]>: You can also use ft3.sourceforge.net Does this also allow having an inverted index without actually storing the files in the database? Cheers, Jos - To unsubscribe, send

Re: [sqlite] OR in virtual tables

2007-02-16 Thread Jos van den Oever
LECT * FROM vtable WHERE x = 'a' AND y='b' UNION SELECT * FROM vtable WHERE x = 'a' AND y='c' The difference is probably not large in most cases. Cheers, Jos Dan. On Fri, 2007-02-16 at 00:31 +0100, Jos van den Oever wrote: > Hi All, > > I'm playing with virtual tables and found tha

[sqlite] OR in virtual tables

2007-02-15 Thread Jos van den Oever
Hi All, I'm playing with virtual tables and found that when i do SELECT * FROM vtable WHERE x = 'a' OR x = 'b' xBestIndex is called without constraints. Is there a way to circumvent this? I dont want sqlite to traverse all the rows just because of the OR statement. The version I'm using is