frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

What is better: a lookup table or an enum type?

https://www.cybertec-postgresql.com/en/lookup-table-or-enum-type/
13•todsacerdoti•3h ago

Comments

sublinear•47m ago
Basically ugly no matter what.

In a lot of web apps this need tends to be related to validation, so many just do these lookups and simple comparisons in their app logic and based on static values from config files long before any db query is made. Sometimes you just don't need to involve the database and the performance would be better for it anyway.

systems•39m ago
well uniformity and homoiconicity are very important in an ideal db management system (a.k.a a true rdbms) everything should be represent as a relation and use the same set of operators to be manipulated

separations of types and relations should be limited to core atomic type, string, int , date etc ... (althought date is debatable as is not usually atomic in most cases, and many dbs end up with one more date relations)

anyway, always use a table .. when its a choice

netcraft•28m ago
couldn't have said it better myself.

Data should be data, queryable, relational. So often I have had to change enums into lookup tables - or worse, duplicate them into lookup tables - because now we need other information attached to the values. Labels, descriptions, colors, etc.

My biggest recommendation though is that if you have a lookup table like this, make the value you would have made an enum not just unique, but _the primary key_. Now all the places that you would be putting an ID have the value just like they would with an enum, and oftentimes you wont need to join. The FK makes sure its valid. The other information is a join away if you need it.

I do wish though that there were more ways to denote certain tables as configuration data vs domain data, besides naming conventions or schemas.

Edit to add: I will say there is one places where I have begrudgingly used enums and thats where we have used something like prisma to get typescript types from the schema. It is useful to have types generated for these values. Of course you can do your own generation of those values based on data, but there is a fundamental difference there between "schema" and "data".

mamcx•10m ago
Yeah, that is what I think on https://tablam.org, where I consider everything could be a relation, so like

    "hello world" ? where #chars != " " == ["h", "e", ...]
CuriouslyC•30m ago
From a maintainability standpoint lookup tables are miles ahead, but from a DX perspective there are a few cases where enums are nice. Honestly I probably would never use enums again, I feel like it's caused pain every time I've done it.

AV1: A Modern, Open Codec

https://netflixtechblog.com/av1-now-powering-30-of-netflix-streaming-02f592242d80
179•CharlesW•2h ago•78 comments

BMW PHEV: When EU engineering becomes a synonym for "unrepairable" (EV Clinic)

https://evclinic.eu/2025/12/04/2021-phev-bmw-ibmucp-21f37e-post-crash-recovery-when-eu-engineerin...
66•mikelabatt•1h ago•28 comments

Trick users and bypass warnings – Modern SVG Clickjacking attacks

https://lyra.horse/blog/2025/12/svg-clickjacking/
50•spartanatreyu•2h ago•5 comments

NeurIPS best paper awards 2025

https://blog.neurips.cc/2025/11/26/announcing-the-neurips-2025-best-paper-awards/
19•ivansavz•1h ago•1 comments

CUDA-l2: Surpassing cuBLAS performance for matrix multiplication through RL

https://github.com/deepreinforce-ai/CUDA-L2
83•dzign•5h ago•11 comments

The Ofcom Files, Part 4: Ofcom Rides Again

https://prestonbyrne.com/2025/12/04/the-ofcom-files-part-4-ofcom-rides-again/
39•parliament32•2h ago•3 comments

Brussels writes so many laws

https://www.siliconcontinent.com/p/how-brussels-writes-so-many-laws
19•amadeuspagel•1h ago•11 comments

Multivox: Volumetric Display

https://github.com/AncientJames/multivox
234•jk_tech•9h ago•30 comments

Transparent leadership beats servant leadership

https://entropicthoughts.com/transparent-leadership-beats-servant-leadership
377•ibobev•13h ago•181 comments

State of AI: An Empirical 100T Token Study with OpenRouter

https://openrouter.ai/state-of-ai
119•anjneymidha•4h ago•47 comments

StardustOS: Library operating system for building light-weight Unikernels

https://github.com/StardustOS
29•transpute•4h ago•1 comments

Thoughts on Go vs. Rust vs. Zig

https://sinclairtarget.com/blog/2025/08/thoughts-on-go-vs.-rust-vs.-zig/
239•yurivish•5h ago•250 comments

Why are 38 percent of Stanford students saying they're disabled?

https://reason.com/2025/12/04/why-are-38-percent-of-stanford-students-saying-theyre-disabled/
496•delichon•8h ago•741 comments

How elites could shape mass preferences as AI reduces persuasion costs

https://arxiv.org/abs/2512.04047
499•50kIters•18h ago•490 comments

Django 6

https://docs.djangoproject.com/en/6.0/releases/6.0/
239•wilhelmklopp•5h ago•118 comments

Help, My Java Object Vanished (and the GC Is Not at Fault)

https://arraying.de/posts/markword/
24•birdculture•5d ago•2 comments

CSS now has an if() conditional function

https://caniuse.com/?search=if
43•aanthonymax•5d ago•11 comments

What is better: a lookup table or an enum type?

https://www.cybertec-postgresql.com/en/lookup-table-or-enum-type/
13•todsacerdoti•3h ago•5 comments

Show HN: Onlyrecipe 2.0 – I added all features HN requested – 4 years later

https://onlyrecipeapp.com/?url=https://www.allrecipes.com/turkish-pasta-recipe-8754903
135•AwkwardPanda•11h ago•118 comments

We gave 5 LLMs $100K to trade stocks for 8 months

https://www.aitradearena.com/research/we-ran-llms-for-8-months
168•cheeseblubber•3h ago•151 comments

PyTogether: Collaborative lightweight real-time Python IDE for teachers/learners

https://github.com/SJRiz/pytogether
64•indigodaddy•9h ago•18 comments

I ignore the spotlight as a staff engineer

https://lalitm.com/software-engineering-outside-the-spotlight/
422•todsacerdoti•15h ago•202 comments

Fighting the age-gated internet

https://www.wired.com/story/age-verification-is-sweeping-the-us-activists-are-fighting-back/
175•geox•13h ago•170 comments

A Cozy Mk IV light aircraft crashed after 3D-printed part was weakened by heat

https://www.bbc.com/news/articles/c1w932vqye0o
223•toss1•6h ago•178 comments

Oedipus is about the act of figuring out what Oedipus is about

https://interconnected.org/home/2025/11/07/oedipus
4•surprisetalk•5d ago•1 comments

Converge (YC S23) is hiring a martech expert in NYC

https://www.runconverge.com/careers/technical-customer-success-manager
1•janhenr•9h ago

Autism should not be treated as a single condition

https://www.economist.com/science-and-technology/2025/12/03/why-autism-should-not-be-treated-as-a...
210•bookofjoe•10h ago•262 comments

It’s time to free JavaScript (2024)

https://javascript.tm/letter
667•pavelai•17h ago•337 comments

PGlite – Embeddable Postgres

https://pglite.dev/
514•dsego•16h ago•103 comments

Functional Quadtrees

https://lbjgruppen.com/en/posts/functional-quadtree-clojure
117•lbj•13h ago•38 comments