     ///
     /// This method is not thread-safe.
     func primaryKey(tableName: String) -> PrimaryKey? {
+        if let primaryKey = primaryKeyCache[tableName] {
+            return primaryKey
+        }
+        
         // https://www.sqlite.org/pragma.html
         //
         // > PRAGMA database.table_info(table-name);

        switch pkColumnInfos.count {
        case 0:
            // No primary key column
            return PrimaryKey.None
        case 1:
            // Single column
            let pkColumnInfo = pkColumnInfos.first!

            return nil
        }
        
        let primaryKey: PrimaryKey
        let pkColumnInfos = columnInfos
            .filter { $0.primaryKeyIndex > 0 }
            .sort { $0.primaryKeyIndex < $1.primaryKeyIndex }
