On 2016/07/04 12:22 PM, Jim Wang wrote:
hi,all
     There is a table include id,string1,string2 and so on.
     So I want to get the value of string1 from a record, there are two methods:
     1.  get by the name of the string2
     2.  get by the index of the string2, the index is 2
    which one is faster?

This is not making sense to me, but I realise there might be a bit of a language barrier, so I will try to guess...

Are you asking whether using the ID (which I assume to be Integer) as a look-up target to finding one of the strings is faster than using an Index on one of the strings? If this is the question, then yes, but only slightly faster. More fast even if the ID is also the INTEGER PRIMARY KEY.

Using the Text in String2 in an Index and then looking up that Index will be a little slower, and more and more slower the more bigger those strings become.

Looking up an Index will be really fast (almost comparable with INT ID look-ups) on strings that look like this:
'ABC'
'JJ1'
'ASX'
'GN001'
etc. and other type short codes.

Looking up long strings that contain sentences or phrases or perhaps whole paragraphs will be much slower.

I hope that answers the question - good luck!
Ryan


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to