SShortSingh.
Back to feed

Storing UUIDs as strings can make MySQL indexes roughly nine times larger than needed

0
·6 views

A UUID is 16 bytes, but schemas that map it to VARCHAR(36) or CHAR(36) under MySQL utf8mb4 reserve 144 bytes per value, and the index repeats that cost. The article estimates a million-row index at about 16 MB in compact binary form versus about 144 MB as strings, adding extra I/O, buffer pool use, and slower comparisons. It recommends storing UUIDs as BINARY(16) with conversion functions, noting that Postgres's native uuid type avoids the problem. It also cautions that truncating UUIDs to short IDs causes collisions much sooner than expected, and that random v4 keys cause insert slowdowns at scale, which time-ordered v7 or ULID values can mitigate at the cost of revealing creation time.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingHacker News ·

Anthropic Files Registration Statement With SEC Ahead of Possible Public Offering

Anthropic PBC has submitted an S-1 registration statement to the U.S. Securities and Exchange Commission, according to a link to the filing shared on Hacker News. The filing is the formal document companies typically submit when preparing to sell shares to the public. The source material provides only the filing link, a discussion thread, and engagement figures, so the document's specific financial details and terms are not described here. Readers seeking the company's disclosures should consult the SEC filing directly.

0
ProgrammingDEV Community ·

Why Input Lag Can Mislead Developers: The Real Causes Behind Sluggish UIs

A developer describes users reporting sluggish input in a web app, where profiling pointed at JavaScript but the actual bottleneck was more complicated. The article explains that browsers pass input events through several stages, including OS processing, event coalescing, dispatch, and handler execution, any of which can introduce delay. It then outlines the rendering pipeline that follows JavaScript work, covering style recalculation, layout, paint, and compositing, which can postpone visible updates. The author notes that common DevTools signals such as Event Timing, Frames, and Long Tasks are easy to misread, since a handler may run late because of earlier work. Input latency therefore includes both event delay and render delay, and diagnosing it requires looking at the full pipeline rather than only the longest JavaScript task.

0
ProgrammingDEV Community ·

Meta open-sources code for building Muse AI gadgets

Meta has released open-source code that lets developers build gadgets powered by its Muse AI model. The article describes a builder who used the Amblyotube repository and the Muse model on a Raspberry Pi to create a gaze-tracking therapy setup for amblyopia. Muse's compact, quantized design allowed on-device inference at around 60 frames per second with a model under 4 MB. Fine-tuning on a few labeled sessions reportedly reduced calibration error from 2.4 degrees to 0.7 degrees. The author encourages others to assemble similar projects from the publicly available code on GitHub.

0
ProgrammingDEV Community ·

Gating agent-written patches on fixture sensitivity instead of green test suites

A passing test suite can be weak evidence for an agent-authored patch, since tests may pass because they have stopped constraining behavior. The article proposes measuring how many deliberate breakages a fixture still catches, rather than only whether tests pass. Its approach combines property obligations, canary mutations, and a freeze registry with expiry, wired into a pre-merge check. The main risk described is fixture drift, where fixtures and assertions gradually loosen as patches are added. The gate is designed to detect this loss of test strength without assuming malicious intent.