Oh, I forgot to mention (if it matters), the "MAIN" table has about 3000
rows in it, while the "LIST" table has about 60000 rows.
Mike


On Mon, Mar 3, 2008 at 3:32 PM, Mike McGonagle <[EMAIL PROTECTED]> wrote:

> Hello all,
> I was working with some queries last night, and ran accross something that
> I don't quite understand. Basically, this is what I have...
>
> ***************************
>
> CREATE TABLE MAIN (
> id integer primary key autoincrement not null,
> name varchar(30),
> [other fields left out, as they are not used]
> );
>
> CREATE TABLE LIST (
> mid integer,
> ord integer,
> data float
> );
>
> -- Compound Query
> SELECT data FROM LIST WHERE mid = (SELECT id FROM MAIN WHERE name =
> "something") ORDER BY ord;
>
> -- Individual Queries
> SELECT id FROM MAIN WHERE name = "something";
> SELECT data FROM LIST WHERE mid = id_as_returned_above;
>
> ***************************
>
> So, what is happening is when I run the first query, it takes about 45
> seconds for the data to be returned. It is correct and everything, just
> takes a long time.
>
> But, when I run the queries in two passes, it comes back pretty quickly,
> nowhere near the 45 seconds it takes for the first compound query.
>
> Is this something that is unique to SQLITE? Or would any database engine
> choke on these sorts of queries? Would this go faster if I create an index
> on 'name'?
>
> I believe that the version of SQLITE that I am running is 3.1.3 (I am not
> on the machine that I was running this on). Is there something out there (on
> the net) that I should read that explains these sorts of things?
>
> Thanks,
>
> Mike
>
>


-- 
Peace may sound simple—one beautiful word— but it requires everything we
have, every quality, every strength, every dream, every high ideal.
—Yehudi Menuhin (1916–1999), musician
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to