frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

You Should Add Debug Views to Your DB

https://chrispenner.ca/posts/views-for-debugging
35•ezekg•3d ago

Comments

vincekerrazzi•2h ago
I agree. So I did. And over the span of a year I was the only one that used them. ¯\_(ツ)_/¯
QuantumSeed•39m ago
I address that problem by scheduling a brown bag lunch and inviting devs from related teams to join in so I can present my cool new tools and techniques to everyone. Sometimes it's wasted effort, but sometimes it does result in wider usage
jerf•2h ago
"Obviously querying over project_shorthand = '@unison/cloud' isn't going to be able to use an index, so isn't going to be the most performant query"

If you know you're going to be querying on username and project shorthand a lot you're just a handful more lines away from instantiating that as a database function which can take your shorthand apart with string functions and get back to a high-performance query. Functions can return rowsets which you can then further filter with WHERE clauses.

Although in that case I think I'd just take the first and second parameters separately anyhow, since

    debug_contribution("sophie", "@unison/cloud")
and

    debug_contributions("sophie", "unison", "cloud")
isn't a big enough difference to be worth writing string-parsing code. But do as you like.
ibejoeb•1h ago
If you're using it regularly, you can make it a derived column and index it in most RDBSs. Then it'll work with predicate push-down and you can do other fancy things like store it on alternative partitions to optimize block reads when you're not using it.

The other obvious benefit is that it is no different in semantics than any other column, so there's no advance knowledge necessary for other users vs using a function.

ndriscoll•2h ago
The next logical step is to realize that using these views to drive your actual application has great potential to both vastly simplify the logic and make it super high performance. You can even take this so far as to make a view that spits out XML (or I guess json): you basically get SSR for free with easy to inspect/compose queries.
Ozzie_osman•2h ago
Or write the query as a function in code, that way, everyone can know it exists, call it easily, and change it along with any other changes to your logic or schema.
al3rez•2h ago
I implemented something similar for a 3M/day ad tech platform. We created a few materialized views for my boss, myself, and the DevOps team to monitor, instead of querying over 100 tables. I used stored procedures in PostgreSQL, which made it fast, efficient, and non-blocking also not to mention we avoided setting up complex Grafana/UI in admin dashboard, boss: i want to know x, y ,z, okay -> tableplus, -> export csv boom!
morkalork•1h ago
This plus some automated assertion checks on whatever invariants you can think of makes for a very cheap and scalable canary.

See an alert? Just query the view and you should have all the client/job/whatever IDs you need to trace the problem.

imACalorie12345•37m ago
I do the same but it typically only stays my personal sphere or documented until you get to something like retool/admin ui as a common place.
noisy_boy•17m ago
I was very confused about the term "Debug" view. We just called them views and used them normally. The main challenge was predicate pushdown which, though usually worked, was somewhat dependent on how smart the optimizer was. Also, things could get tricky when you start building views on top of views. Soon you are not certain why a simple looking query selecting from a simple looking view became slow until you see that it is views all the way down. As with most things, balance is the key.
ericHosick•9m ago
To help understand why a complex query with many joins comes back empty, I like to provide helper debug functions that builds the query step by step. Each block checks one prerequisite and tells the user what’s missing:

```sql FUNCTION debug_user(user_id):

  IF NOT (SELECT FROM user WHERE user.user_id = user_id) THEN
    -- user doesn’t exist
  END IF;

  IF NOT (SELECT FROM user
           JOIN user_addr ON user_addr.user_id = user.user_id
           WHERE user.user_id = user_id) THEN
    -- user has no address
  END IF;

  -- keep adding joins until you find the break
```

because when you have a query that involves 6 relations, and you don't get results, it is nice to know why.

Apple Watch wearable foundation model

https://arxiv.org/abs/2507.00191
106•brandonb•2h ago•12 comments

AWS CEO says using AI to replace junior staff is 'Dumbest thing I've ever heard'

https://www.theregister.com/2025/08/21/aws_ceo_entry_level_jobs_opinion/
965•JustExAWS•4h ago•343 comments

95% of Companies See 'Zero Return' on $30B Generative AI Spend

https://thedailyadda.com/95-of-companies-see-zero-return-on-30-billion-generative-ai-spend-mit-report-finds/
275•speckx•1h ago•261 comments

Unity reintroduces the Runtime Fee through its Industry license

https://unity.com/products/unity-industry
91•finnsquared•2h ago•26 comments

Weaponizing image scaling against production AI systems

https://blog.trailofbits.com/2025/08/21/weaponizing-image-scaling-against-production-ai-systems/
170•tatersolid•5h ago•46 comments

Using Podman, Compose and BuildKit

https://emersion.fr/blog/2025/using-podman-compose-and-buildkit/
169•LaSombra•6h ago•37 comments

Cua (YC X25) Is Hiring Founding Design Engineers in SF

https://www.ycombinator.com/companies/cua/jobs/a6UbTvG-founding-engineer-ux-design
1•frabonacci•21m ago

Unmasking the Privacy Risks of Apple Intelligence

https://www.lumia.security/blog/applestorm
31•mroi•1h ago•3 comments

D4d4

https://www.nmichaels.org/musings/d4d4/d4d4/
371•csense•4d ago•44 comments

Show HN: OS X Mavericks Forever

https://mavericksforever.com/
198•Wowfunhappy•3d ago•79 comments

Adding my home electricity uptime to status.href.cat

https://aggressivelyparaphrasing.me/2025/08/21/adding-my-home-electricity-uptime-to-status-href-cat/
10•todsacerdoti•1h ago•4 comments

Launch HN: Skope (YC S25) – Outcome-based pricing for software products

17•benjsm•2h ago•10 comments

Bank forced to rehire workers after lying about chatbot productivity, union says

https://arstechnica.com/tech-policy/2025/08/bank-forced-to-rehire-workers-after-lying-about-chatbot-productivity-union-says/
68•ndsipa_pomu•1h ago•10 comments

Show HN: ChartDB Cloud – Visualize and Share Database Diagrams

https://app.chartdb.io
52•Jonathanfishner•4h ago•7 comments

Mark Zuckerberg freezes AI hiring amid bubble fears

https://www.telegraph.co.uk/business/2025/08/21/zuckerberg-freezes-ai-hiring-amid-bubble-fears/
442•pera•6h ago•423 comments

Show HN: Using Common Lisp from Inside the Browser

https://turtleware.eu/posts/Using-Common-Lisp-from-inside-the-Browser.html
67•jackdaniel•5h ago•8 comments

Forced every engineer to take sales calls.They rewrote our platform in 2 weeks

https://old.reddit.com/r/Entrepreneur/comments/1mw5yfg/forced_every_engineer_to_take_sales_calls_they/
75•bilsbie•1h ago•39 comments

You Should Add Debug Views to Your DB

https://chrispenner.ca/posts/views-for-debugging
35•ezekg•3d ago•12 comments

How Well Does the Money Laundering Control System Work?

https://www.journals.uchicago.edu/doi/10.1086/735665
127•PaulHoule•4h ago•113 comments

Why is D3 so Verbose?

https://theheasman.com/short_stories/why-is-d3-code-so-long-and-complicated-or-why-is-it-so-verbose/
54•TheHeasman•7h ago•39 comments

Margin debt surges to record high

https://www.advisorperspectives.com/dshort/updates/2025/07/23/margin-debt-surges-record-high-june-2025
148•pera•6h ago•192 comments

Unification (2018)

https://eli.thegreenplace.net/2018/unification/
66•asplake•3d ago•14 comments

AI crawlers, fetchers are blowing up websites; Meta, OpenAI are worst offenders

https://www.theregister.com/2025/08/21/ai_crawler_traffic/
162•rntn•5h ago•75 comments

Home Depot sued for 'secretly' using facial recognition at self-checkouts

https://petapixel.com/2025/08/20/home-depot-sued-for-secretly-using-facial-recognition-technology-on-self-checkout-cameras/
307•mikece•1d ago•418 comments

A summary of recent AI research (2016)

https://blog.plan99.net/the-science-of-westworld-ec624585e47
4•mike_hearn•1h ago•0 comments

Show HN: I replaced vector databases with Git for AI memory (PoC)

https://github.com/Growth-Kinetics/DiffMem
158•alexmrv•11h ago•36 comments

A Conceptual Model for Storage Unification

https://jack-vanlightly.com/blog/2025/8/21/a-conceptual-model-for-storage-unification
18•avinassh•4h ago•1 comments

Epson MX-80 Fonts

https://mw.rat.bz/MX-80/
156•m_walden•4d ago•57 comments

Sixteen bottles of wine riddle

https://chriskw.xyz/2025/08/11/Wine/
43•chriskw•4d ago•23 comments

A statistical analysis of Rotten Tomatoes

https://www.statsignificant.com/p/is-rotten-tomatoes-still-reliable
206•m463•17h ago•126 comments