SShortSingh.
Back to feed

GIN or GiST: How to Choose a Postgres Index for Non-Scalar Data

0
·2 views

A developer who relied on GIN indexes for every non-scalar Postgres column found them slowing down inserts on a write-heavy table. GIN is an inverted index that maps each key within a value to the rows containing it, making containment and membership lookups fast but adding write overhead for every key. GiST is a balanced tree of summaries that supports nearest-neighbour ordering and exclusion constraints, which GIN cannot provide, though its reads often need rechecks. The author suggests GIN for jsonb containment, array membership, and mostly-read full-text search, while favouring GiST for geometry, ranges, and exclusion constraints. The advice stresses measuring read and write performance on realistic workloads rather than guessing.

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
ProgrammingDEV Community ·

Shipkeep backup flaw let a genuine but outdated archive pass restore checks

Shipkeep, an open-source platform for deploying apps on your own servers, backs up its PostgreSQL database and encryption key together in an age-encrypted archive. Its restore process verified archives with an HMAC tag, which confirmed that the archive was made by a server holding the installation's backup key. However, the check did not confirm that the archive was the specific one the operator requested, so anyone able to write to the storage could substitute an older valid backup. Such a rollback would restore revoked tokens, old passwords, and removed members while every check still passed. The fix adds a version 2 manifest that includes the archive's name under the HMAC, and the restore now compares that name against the one requested.

0
ProgrammingDEV Community ·

New API Flags Disposable Emails and Risky Signups in Real Time

A developer has released a lightweight API that screens email addresses during SaaS signups to curb abuse of free trials and freemium tiers. The service returns an ALLOW, REVIEW, or BLOCK decision for any given address. It checks against a daily-synced list of over 5,000 temporary email providers and uses RDAP data to flag newly registered domains and shared inboxes such as admin or support addresses. The article includes a sample JavaScript integration and a sample response showing a high-risk score for a disposable domain lacking MX records. The tool is offered through RapidAPI with a free tier, and the author invited readers to share other signals they use to stop fake signups.

0
ProgrammingDEV Community ·

SurgVisDom Study Finds Simulated Surgery Data Alone Falls Short for AI Models

Researchers behind the MICCAI 2020 SurgVisDom challenge examined whether AI models trained on virtual-reality surgical exercises could recognize tasks in clinical-like settings. The tested models did not learn meaningful motion-based features from virtual-reality data alone. Performance improved when some clinical-like data was added, highlighting where simulation needs support from other examples. The 2021 report describes competing approaches and offers a public dataset for further study. Aneeq Zia, a Georgia Tech Ph.D. graduate whose earlier doctoral work focused on machine-learning assessment of surgical skills, is first-listed on the report.

0
ProgrammingDEV Community ·

Team BackTrack Ranks 26th of 369 Teams in RedReaper CTF Qualifiers

Team BackTrack placed 26th out of 369 global teams in the RedReaper CTF qualification round, earning 4,110 points. The competition covered a wide range of challenges, including custom bytecode virtual machines, Windows forensics, font-file state machines, and constraint solving with Z3. Reversing tasks often involved stripped x86-64 binaries, which the team tackled with Python automation and symbolic inversion. Forensics challenges required correlating disk images and packet captures to reconstruct timelines, while miscellaneous puzzles spanned font automata, Conway's Game of Life, and open-source intelligence. The team credited early automation and cross-referencing of artifacts with saving significant solving time.