Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Jelle Klap wrote:I fail to see how JDBC can be viewed as an alternative to SQL? In any case, it's usually a better option to let the database handle unions, joins, orderings et al. If you can get the desired result from a single query, make the effort to do so, because that's what the relational database is there for and that's what it's best at.
If you can get the desired result from a single query, make the effort to do so, because that's what the relational database is there for and that's what it's best at
Paul Sturrock wrote:
If you can get the desired result from a single query, make the effort to do so, because that's what the relational database is there for and that's what it's best at
I think I disagree with this. There are a whole bunch of things a database can do in a single query and its often debatable whether you should do. For example, you can format output as part of a query pushing more load onto the database when the best place to handle display logic is in the client that displays the data. Ordering too is debatable, database ordering is often defined by collation rules which are locale specific and may differ from the rules for the client.
Any query with aggregations or other functions in select or where clauses is worth considering too. Anyhting that tends towards business logic is better in the application not the database.
Then there is the possibility of a large, complex query bringing the database to its knees. OK, you could argue that this is apoorly designed query (or a poorly configured database) but if you push complex logic into the client you tend to brteak an application for one uiser only, rather than everyone. Not always possible I know, but worth considering if you can do it.
Paul Sturrock wrote:I think what I'm saying is "it depends" and you need to consider what is best for your situation, rather than stick to one rule.
Paul Sturrock wrote:I think what I'm saying is "it depends" and you need to consider what is best for your situation, rather than stick to one rule.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.