Yeah I tried that myself - I took that benchmark script and changed the CREATE TABLE lines to look like this (adding the primary key):
CREATE TABLE store(key TEXT PRIMARY KEY, value TEXT)
Here are the results before I made that change: sqlite
Took 0.032 seconds, 3.19541 microseconds / record
dict_open
Took 0.002 seconds, 0.20261 microseconds / record
dbm_open
Took 0.043 seconds, 4.26550 microseconds / record
sqlite3_mem_open
Took 2.240 seconds, 224.02620 microseconds / record
sqlite3_file_open
Took 7.119 seconds, 711.87410 microseconds / record
And here's what I got after adding the primary keys: sqlite
Took 0.040 seconds, 3.97618 microseconds / record
dict_open
Took 0.002 seconds, 0.19641 microseconds / record
dbm_open
Took 0.042 seconds, 4.18961 microseconds / record
sqlite3_mem_open
Took 0.116 seconds, 11.58359 microseconds / record
sqlite3_file_open
Took 5.571 seconds, 557.13968 microseconds / record
My code is here: https://gist.github.com/simonw/019ddf08150178d49f4967cc38356...