¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: unit test condition on sql statement


 

What does "almost as fast" mean in practice?

20 ms is "almost as fast" as 0.5 ms for the first hundred or so tests.

That said: *sometimes* in the case of tricky dynamically built sql (for example: lists with paging, sorting, and filtering on multiple fields), I like to write integration-with-the-database tests, regardless of the method/tool used to build the queries.

A couple of the optimizations you might end up at here are:
1) introduce a view to make querying more convenient
2) introduce eventuality for performance reasons (for example a materialized view that is updated on a schedule).

Sometimes it feels like turning these problems that are easily/elegantly solved in SQL into tests over OO programming language abstractions makes it harder to find the simplest solution.

Join [email protected] to automatically receive all group messages.