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

> you dont need unit test if you table design is clean, because SQL operators are deterministic and are tested by the RDBMS vendor

Imagine well structured tables in 3rd normal form.

And then a view which joins 20 tables and creates a report with myriad of case/then expressions.

Many things can go wrong. (Wrong join conditions, duplicate rows, omitted rows, wrong formulas)

You might say that there should be no such logic in database and I understand the sentiment, but circumstances (e.g. performance) might say it’s needed.



Performance of complex query is totally depends on the query planner, which depends on 1) table size, 2) data cardinality, 3) table statistics

It is only testable on real production database, so you can do test of complex queries on backup of your prod to get a sense of performance.

But still query can degrade unexpectedly under consistent load in prod from other queries




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

Search: