> in application programming languages tend to be much richer than SQL.
Hence why i say why there is a data model mismatch.
E.g. i wouldn't say that assembly and haskell have a compatible data model just because assembly is a sequence of bytes, and haskell is a superset of that.
Not that a data model is solely about the types involved.
> See orms for reference. ORMS have their own set of problems but data mismatches are not part of those problems.
ORMs are notorious for being a leaky abstraction. Largely because the object and relational data model dont entirely match.
> In general the classic model for web development is to place as much logic as possible into the SQL query and as little logic as possible into your heavy Python web app.
When was the last time you wrote a 500 line sql query? A thousand line? My point is that sql queries are short enough, that further abstraction is not really missed. That doesn't mean you should put 0 logic in your query.
> Case in point do you put your where clause in the application program than download the entire table? Or do you throw as much logic as possible into the query so the database outputs a result as close as possible to what you need? The later statement is the right answer.
This is a strawman.
> The bigger issue is SQL optimization. Because Databases form the backbone of computation for a standard web app SQL provides a layer of indirection that makes optimization harder
I disagree. At scale you have data that has mixed cardinality. The indirection allows the db to chose the best algorithm given the size of underlying data at runtime. Sometimes that doesn't work properly, but the vast majority of time it is a significant benefit. Its sort of like how sometimes compilers dont work properly and you need to hand optimize, but in practise that is rare and you wouldn't throw out the compiler because the other 95% of time its better and lower effort than if you had to always do it by hand.