Re: [sqlite] can you speed this query up?

2006-05-23 Thread A. Pagaltzis
* A. Pagaltzis <[EMAIL PROTECTED]> [2006-05-23 09:40]: > Now we can group together the conditions which do not involve > the `bounds` table: > > (r.qi = 5604 AND r.ri <= 5468) OR (r.ri = 5468 AND r.qi <= 5604) > AND r.qi >= b.bqis > AND r.ri >= b.bris > AND b.bi = 1

Re: [sqlite] can you speed this query up?

2006-05-23 Thread A. Pagaltzis
* Adrian Ho <[EMAIL PROTECTED]> [2006-05-23 16:05]: > On Tue, May 23, 2006 at 08:50:56AM +0200, A. Pagaltzis wrote: > > * [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2006-05-23 02:35]: > > > What you have to do is: > > > > > >SELECT qi, ri, drl, score > > > FROM ... > > > WHERE score=(SELE

Re: [sqlite] can you speed this query up?

2006-05-23 Thread A. Pagaltzis
Hi Brannon, * Brannon King <[EMAIL PROTECTED]> [2006-05-23 20:05]: > Thank you for taking the time to sort out my query! NP. I have only recently studied SQL in depth, and this was an interesting exercise. > This one above was as slow as the original. Yes, as expected – it is exactly the same

RE: [sqlite] can you speed this query up?

2006-05-23 Thread Brannon King
Thank you for taking the time to sort out my query! (The meat is at the bottom.) > SELECT > r.qi, > r.ri, > r.drl, > r.score > FROM > results_1 r > INNER JOIN bounds b ON > r.qis = b.bqis AND r.ris = b.bris > WHERE > (

Re: [sqlite] can you speed this query up?

2006-05-23 Thread Dennis Cote
A. Pagaltzis wrote: I can’t interpret the `EXPLAIN` output well enough to tell whether this is likely to be faster, I’m afraid. (Actually I don’t even understand how to tell whether/which indices are being used; I tried creating a few and they didn’t seem to make a discernible difference.) T

Re: [sqlite] can you speed this query up?

2006-05-23 Thread Adrian Ho
On Tue, May 23, 2006 at 08:50:56AM +0200, A. Pagaltzis wrote: > * [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2006-05-23 02:35]: > > What you have to do is: > > > >SELECT qi, ri, drl, score > > FROM ... > > WHERE score=(SELECT max(score) FROM ...) > > Actually, in cases such as this, the

Re: [sqlite] can you speed this query up?

2006-05-23 Thread A. Pagaltzis
* Brannon King <[EMAIL PROTECTED]> [2006-05-23 01:40]: > It seems that I yet need help with another query. This one is just too slow. > I've included the "explain" and the table schema. I've been using the > prepare/step model directly. What should I change on my indexing to make it > faster? > >

Re: [sqlite] can you speed this query up?

2006-05-22 Thread A. Pagaltzis
* [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2006-05-23 02:35]: > What you have to do is: > >SELECT qi, ri, drl, score > FROM ... > WHERE score=(SELECT max(score) FROM ...) Actually, in cases such as this, the easiest approach is to use `LIMIT`: SELECT qi, ri, drl, score FROM ..

Re: [sqlite] can you speed this query up?

2006-05-22 Thread A. Pagaltzis
Hi Brannon, * Brannon King <[EMAIL PROTECTED]> [2006-05-23 05:35]: * [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2006-05-23 02:35]: > >select qi, ri, drl, max(score), min(score) from ... > > > >What values of qi, ri, and drl would you want > >this query to return? > > > >What you have to do is: > > > >

Re: [sqlite] can you speed this query up?

2006-05-22 Thread Brannon King
select qi, ri, drl, max(score), min(score) from ... What values of qi, ri, and drl would you want this query to return? What you have to do is: SELECT qi, ri, drl, score FROM ... WHERE score=(SELECT max(score) FROM ...) Thank you for the instruction, although the other query s

Re: [sqlite] can you speed this query up?

2006-05-22 Thread drh
"Brannon King" <[EMAIL PROTECTED]> wrote: > select qi,ri,drl,max(score) as scr from ... Are you expecting the qi, ri, and drl values to be the ones from the row with the maximum score? I hate to disappoint you, but SQL (not just SQLite but SQL in general) does not work this way. To understand wh

[sqlite] can you speed this query up?

2006-05-22 Thread Brannon King
It seems that I yet need help with another query. This one is just too slow. I've included the "explain" and the table schema. I've been using the prepare/step model directly. What should I change on my indexing to make it faster? The schema: CREATE TEMPORARY TABLE IF NOT EXISTS bounds (bi INTEGER