Re: [sqlite] Huge performance drop when using prepared statement

2007-12-10 Thread Markus Gritsch
On 10/12/2007, Ed Pasma <[EMAIL PROTECTED]> wrote: > Hello, think I got it, but it is disappointingly simple, see below. Ed. > > Markus Gritsch wrote: > > > Even more strange: > > > > c.execute("""SELECT * FROM entry, word, word_entry WHERE &

Re: [sqlite] Huge performance drop when using prepared statement

2007-12-09 Thread Markus Gritsch
On 09/12/2007, Markus Gritsch <[EMAIL PROTECTED]> wrote: > On 09/12/2007, D. Richard Hipp <[EMAIL PROTECTED]> wrote: > > > > SQLite will optimize a GLOB where the right parameter is > > a literal string. It will not do so if the right parameter is a >

Re: [sqlite] Huge performance drop when using prepared statement

2007-12-09 Thread Markus Gritsch
On 09/12/2007, Mag. Wilhelm Braun <[EMAIL PROTECTED]> wrote: > hi Markus, Hi Wilhelm > I just tried for fun: > > start = time.time() > SQLString=('''SELECT * FROM entry, word, word_entry WHERE > entry.id = word_entry.entry_id AND > word.id = word_entry.word_id AND > word.word GLOB '%s' > ''' %

Re: [sqlite] Huge performance drop when using prepared statement

2007-12-09 Thread Markus Gritsch
On 09/12/2007, D. Richard Hipp <[EMAIL PROTECTED]> wrote: > > On Dec 9, 2007, at 5:27 AM, Kees Nuyt wrote: > > > Problematic SELECT: > >> c.execute("""SELECT * FROM entry, word, word_entry WHERE > >> entry.id = word_entry.entry_id AND > >> word.id = word_entry.word_id AND > >> word.word GLOB ? >

Re: [sqlite] Huge performance drop when using prepared statement

2007-12-09 Thread Markus Gritsch
On 09/12/2007, Kees Nuyt <[EMAIL PROTECTED]> wrote: > On Sun, 9 Dec 2007 10:55:16 +0100, "Markus Gritsch" > <[EMAIL PROTECTED]> wrote: > > >Hi, > > > >when using bind variables I get a huge performace drop compared to > >using a plain

[sqlite] Huge performance drop when using prepared statement

2007-12-09 Thread Markus Gritsch
Hi, when using bind variables I get a huge performace drop compared to using a plain string. The query is demonstrated in the attached file "problematic_query.py". The database used can be downloaded from http://xile.org/le/prepared_statement.zip (1.75 MB) or generated by using the attached f

Re: [sqlite] How to escape a literal _ in a query using the LIKE operator

2004-11-14 Thread Markus Gritsch
Kurt Welgehausen wrote: ... LIKE 'ba_foo\_png' but this does not seem to work. The escape mechanism for LIKE has never been implemented in SQLite. The work-around is to use GLOB if your pattern contains '_' or '%' (unfortunately, GLOB is not std SQL). In case you're curious, the std SQL syntax is

[sqlite] How to escape a literal _ in a query using the LIKE operator

2004-11-14 Thread Markus Gritsch
Hi! Say I want to match 'barfoo' and 'bazfoo', I can use LIKE 'ba_foo' If I want to match 'barfoo_png' and 'bazfoo_png', but not 'barfooxpng', I have to escape the underscore before png. I tried LIKE 'ba_foo\_png' but this does not seem to work. Is there a proper solution? Markus