Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8723095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:32:55+00:00 2026-06-13T07:32:55+00:00

Ive been trying to get sqlite to use an index with a like to

  • 0

Ive been trying to get sqlite to use an index with a like to no avail. Ive tried collate nocase and still no luck. Anyone have any ideas on how to get sqlite to do a like hitting an index. Thanks in advance

DROP TABLE IF EXISTS "test";
DROP TABLE IF EXISTS "test2";
DROP TABLE IF EXISTS "test3";
create table test(name TEXT COLLATE NOCASE);
create table test2(name TEXT);
create table test3(name TEXT);
create index idx_test_name on test(name);
create index idx_test2_name on test2(name);
create index idx_test3_name on test3(name COLLATE NOCASE);
insert into test(name) values('dan');
insert into test2(name) values('dan');
insert into test3(name) values('dan');
--explain query plan select * from test where name like 'test%' 
-- explain query plan select * from test2 where name like 'test%' 
-- explain query plan select * from test3 where name like 'test%' 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:32:56+00:00Added an answer on June 13, 2026 at 7:32 am

    In SQLite 3.6.23.1, the index on test is used:

    > explain query plan select * from test where name like 'test%';
    TABLE test WITH INDEX idx_test_name
    
    > explain query plan select * from test2 where name like 'test%';
    TABLE test2
    
    > explain query plan select * from test3 where name like 'test%';
    TABLE test3
    

    With a development version of SQLite 3.7.15, both test‘s and test3‘s indexes are used (the index on test2 is used for scanning, not searching):

    > explain query plan select * from test where name like 'test%';
    SEARCH TABLE test USING COVERING INDEX idx_test_name (name>? AND name<?) (~31250 rows)
    
    > explain query plan select * from test2 where name like 'test%';
    SCAN TABLE test2 USING COVERING INDEX idx_test2_name (~500000 rows)
    
    > explain query plan select * from test3 where name like 'test%';
    SEARCH TABLE test3 USING COVERING INDEX idx_test3_name (name>? AND name<?) (~31250 rows)
    

    So the answer is to update SQLite.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been unsuccessful in trying to find an example how to get a sqlite
Ive been trying for a while now to get a rich textbox to populate
Ive been trying unsuccessfully for a few days now to get a button to
Ive been trying to get this solved for quite a few hours, but I
Ive been trying to get the parent of this WebBrowser control. Somehow i can't
Ive been trying to get a listview working within a fragment all day. I
Ive been trying to get an example Web Service working using SpringWS and Tomcat5.5
Ive been trying to get the VIM auto completion working, but am running into
Hi guys ive been trying to get smooth scrolling working on my anchors for
Ive been trying to write my first Blackberry Adobe Flex application but get the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.