Skip to content

execute_insert does redundant query #379

@lunixbochs

Description

@lunixbochs

I got about a 10% speedup patching execute_insert to use sqlite3's cursor.lastrowid, and another 3% and cleaner code if I remove the tuple (at the expense of the api returning an object of a different shape)

def execute_insert(self, sql: str, parameters: Any) -> Optional[tuple[int]]:
    cursor = self._conn.execute(sql, parameters)
    return (cursor.lastrowid,)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions