On Wed, Jun 30, 2010 at 12:02 AM, Simon Slavin <slav...@bigfraud.org> wrote:

>
> On 29 Jun 2010, at 11:57pm, J. Rios wrote:
>
> >>> I have created the next indexes : index1( name ), index2( id2 ),
> index3(
> >>> name2 );
>
> Those are very unlikely to be of any use at all.  They're probably a waste
> of space.
>
> > Its not the primary Key. There are more fields but the index on id is
> > created also. Sorry I missed it in the post.
> >
> > If I do a EXPLAIN QUERY PLAN sqlite tells me its going to use the id
> INDEX.
> > But the sorting is slow.
>
> Please post your SELECT command again.  It seems like none of the indexes
> you've added are being used.  And please add your new text /below/ the parts
> of other posts that you quote.  English is read from top to bottom.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>

Sorry for posting on top of the message,
  This is my original post with the query you request

I have the next table

table1( id INTEGER, name VARCHAR, id2 INTEGER, name2 VARCHAR, year INTEGER
);

I have created the next indexes : index1( name ), index2( id2 ), index3(
name2 );

The database have about 200,000 records.
The next query takes about 2 seconds and I think its too much.

SELECT id, name, id2, name2 GROUP BY id ORDER BY name2, year DESC LIMIT 0,
15

If I remove the sorting condition the query is instantaneous.

How can I make it faster?

Thanks in advance
J.Rios
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to