On Tue, Jan 10, 2012 at 12:56 PM, trash Spam <wwwtrashs...@gmail.com> wrote:

> Hi,
>
> Simplified example :
> Table t1
> (
>     col1    number  primary key
>    ,col2    varchar( 50 )
>    ,col3    number
> )
>
> select
>    min( col3 )
> fro
>    t1
> ;
> explain plan :
> order    from    detail
> 0        0        TABLE t1 WITH INDEX idx_t1_col3 ORDER BY
>
> select
>    min( col3 ) + 1
> fro
>    t1
> ;
> order    from    detail
> 0        0        TABLE t1
>
> Why the second case cannot use index idx_t1_col3 ?
>
> How i can force the query to use the index ?
>


SELECT (SELECT min(col3) FROM t1)+1;


>
> In the real case the query is :
> select
>    col2
> from
>    t1
> where
>   col3 = (
>                  select
>                          min( col3 ) + :delta
>                  from
>                         t1
>  )
> ;
> I don't know the explain plan with bind variable.
>
> Thanks.
>
> --
> Philippe.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to