[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sqlite-users
Subject:    Re: [sqlite] Re: Optimization!
From:       "Cesar David Rodas Maldonado" <saddor () gmail ! com>
Date:       2006-07-31 19:09:43
Message-ID: 239036620607311209q6e3db21ax9c745d9f1aad1212 () mail ! gmail ! com
[Download RAW message or body]


Cool!

I will try that!

Thanks Igor!


On 7/31/06, Igor Tandetnik <itandetnik@mvps.org> wrote:
>
> Cesar David Rodas Maldonado
> <saddor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > How can I optimize this query
> >
> > select * from table where col1 = 5 && col2 = 15;
> >
> > If I  know that col2 I have 150000 rows and col1 I have just 100
> > rows, I know that because I save that data in another table.
> >
> > How can I do for search first where is minus number of result?
> >
> >
> > The two columns are indexes.
>
> Try making it
>
> select * from table where col1 = 5 and +col2 = 15;
>
> The unary plus in front of col2 disqualifies it for use in an index, so
> SQLite is likely to use an index on col1.
>
> Igor Tandetnik
>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic