jeudi 25 février 2016

SQLite use autoindex instead my own index

I've problem with SQLite autoindex in UNIQUE table. I've create table like below.

c.execute('''CREATE TABLE social(
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL UNIQUE,
    tampil INTEGER NOT NULL
    );'''
)
c.execute('CREATE INDEX medp on social(name);')

But when I check using explain query plan, SQLite use the autoindex provide by itself. How to avoid this to use my own index instead of it's auto index? How I try:

c.execute('EXPLAIN QUERY PLAN SELECT id FROM social WHERE name = "facebook"')

And the resut is:

(0, 0, 0, 'SEARCH TABLE social USING INDEX sqlite_autoindex_social_1(name=?))

Thank you before.

Aucun commentaire:

Enregistrer un commentaire