Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In case anyone is looking for a performant way to implement categories like that in Postgres: https://news.ycombinator.com/item?id=33251745

I stumbled across that comment a few years back and it changed the way I handle tags and categories so just sharing it here. If anyone has an equivalent for Sqlite, I’d love to hear it!




It's a relational database: why not just use a PageCategories table with two foreign keys?


That's what my suggestion came down to. A two column table with company id and category id. They had ids already. They could index off category and get the results in split seconds


postgres also supports gin indexes, so could do int arrays & contains queries, for example.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: