bitbake: persist_data: Add key constraints

Constructs the "key" column in the persistent database as a non-NULL
primary key. This significantly speeds up lookup operations in large
databases.

[YOCTO #13030]

(Bitbake rev: f5ba7775cfcb90401522d977cc66fe0f5aeb7a66)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Watt
2018-12-03 21:42:31 -06:00
committed by Richard Purdie
parent 7afa726bec
commit 549eccc0db

View File

@@ -94,7 +94,7 @@ class SQLTable(collections.MutableMapping):
self.table = table
self.connection = connect(self.cachefile)
self._execute_single("CREATE TABLE IF NOT EXISTS %s(key TEXT, value TEXT);" % table)
self._execute_single("CREATE TABLE IF NOT EXISTS %s(key TEXT PRIMARY KEY NOT NULL, value TEXT);" % table)
@_Decorators.retry
@_Decorators.transaction