On 25 Jun 2010, at 3:46pm, Nilesh SIMARIA wrote: > We have one more column in table of type blob and we have to > do look up based on that column as well. > > The query looks like this :- > > "SELECT * from table where parent == ? and c_blob == ?" > > We have to execute this query multiple times. So basically we have two > queries (first I explained previous mail) in that case how would you suggest > to create table > > A) Two Indexed one on (parent, aid) and other on (parent, c_blob) > B) One Index on (parent, aid, c_blob) > > Which one would be fast for select ?
Each SELECT command will only ever use a maximum of one index. I would make a new index especially for this new SELECT command, as in your option (A). If you don't make the index specially for it (which is something you might do if you want INSERT to be very fast or need to economise on filespace) then it would take advantage of an index which starts with 'parent'. But even on your index for option (B) it would still only use the 'parent' part so you might as well stick with (parent, aid). Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users