I have the following query:
    SELECT used
    FROM   usedProverbs
    LIMIT  1

The view useProverbs is defined as:
    CREATE VIEW usedProverbs AS
    SELECT   *
    FROM     proverbs
    WHERE    CAST(used AS INT) <> 0
    ORDER BY used ASC

But I am told this is not clear and that I should use:
    SELECT   used
    FROM     usedProverbs
    ORDER BY used
    LIMIT    1

But when I use those in DBBrowser, the first takes almost always 0 ms,
while the second takes between 13 and 16 ms. Why does the second one take
so much more time?

The definition of proverbs:
    CREATE TABLE proverbs (
        proverbID   INTEGER PRIMARY KEY AUTOINCREMENT,
        proverb     TEXT    NOT NULL UNIQUE,
        used        TEXT    DEFAULT 'notUsed'
    );

​To be sure I also executed it in sqlite3 after .timer on. Here the first
one almost always gives​:
    Run Time: real 0.000 user 0.000000 sys 0.000000
and sometimes:
    Run Time: real 0.001 user 0.000000 sys 0.000000

The second one gives mostly:
    Run Time: real 0.006 user 0.004000 sys 0.000000
but sometimes it get as low as:
    Run Time: real 0.003 user 0.004000 sys 0.000000

​Both are using 3.16.2​. Would 3.20.0 make a difference? Then I could
install that one and see the results from that. (The JDBC uses 3.20.2.)

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

Reply via email to