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
> >  entry.id = word_entry.entry_id AND
> >  word.id = word_entry.word_id AND
> >  word.word GLOB ?
> > """, ('tes*',))
> >
> > takes less than 1ms but
> >
> > 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 ?
> > """, ('test',))
> >
> > takes several hundred ms.
>
> The execute in Python includes prepare (or get from cache), bind and
> the first step.
> The answer must be that the wait time lies in the first step.
> The engine is doing a full scan and it all depends how far in the
> table it needs to go to find the first match.
> So the bind values with * just come across a match sooner.

Yes, I think your explanation is correct.  Thank you.  If I actually
fetch all results by calling c.fetchall() after issuing the queries,
both of them take several hundret ms.

Thank you again,
Markus

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to