Just to give a bit more context to my comments. I can’t tell what is better, Prolog-style fixed operational semantics + some amount of magic in clause indexing, or “declarative” queries and very explicit indexing + black-box query optimizations, as implemented by the major relational DB vendors.
However, from a technical point of view, it does seem more reasonable to be able to add the magic of the query optimization if you think you need it, through a library, and even better, to have access to the implementation. Here, by “access” I mean two things: a) the implementation is open source and b) it is written in a high-level language (Prolog) so it is in practice accessible.
SQL being as widely used as it is is probably a historical accident. Its main selling points (queries in a “natural language”, “declarative” etc) do fall apart if you scrutinize them. And SQL is a pain to parse or generate mechanically, and read and write by a person, nearly impossible to write reusable blocks, and so on.
Aaaand, there is this whole thing that has been ongoing for decades: https://en.wikipedia.org/wiki/D_(data_language_specification). This is just to demonstrate that people who are very invested in relational databases as a concept and a technology still do not think that SQL is any good whatsoever.