RSS Amplifier

Jim Kalafut · Jul 8, 2024

Should've AUTOINCREMENTed

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

The SQLite docs steer you away from AUTOINCREMENT: The AUTOINCREMENT keyword imposes extra CPU, memory, disk space, and disk I/O overhead and should be avoided if not strictly needed. It is usually not needed. The short version of not using AUTOINCREMENT is that primary keys can be reused following their deletion. And the problems with not properly accounting for this just bit me. In my case, a…

The SQLite docs steer you away from AUTOINCREMENT: The AUTOINCREMENT keyword imposes extra CPU, memory, disk space, and disk I/O overhead and should be avoided if not strictly needed. It is usually not needed. The short version of not using AUTOINCREMENT is that primary keys can be reused following their deletion. And the problems with not properly accounting for this just bit me. In my case, a cache in my app was referencing a user ID, which meant that following a user deletion and creation, the old cache data was associated with the new user 😬.

Read on /posts/shouldve-autoincremented/

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.