DEV Community

Discussion on: Spot a leaky abstraction

Collapse
 
stereobooster profile image
stereobooster

To be clear:

  • the fact there is one tiny leaky abstraction, doesn't disqualify all technology at once. SQL is just fine. This thing with indexes is fine, but I guess we can do better (and this is hard, otherwise people would already come up with better solution)
  • I never said, that learning new things is bad. For sure learn everything, learn as much as possible. But also take into account, that there maybe people who don't want to do it, but they will be forced or frustrated. Like what if this somebody from BI, they don't have a clue what BTree is

Now about leaky abstraction. I wrote whole paragraph explaining why but, I guess, my explanations unclear. Help me to understand what is unclear in my explanation.

The abstraction itself consist of relations (expressed as foreign keys or joins by some field), entities (expressed as tuples in tables), normal forms. None of those mention indexes, right?

Indexes required only because we need to make it fast, to be usable on practice. What if instead of exposing indexes, I would provide database with the list of queries I want to run and it would use some of heuristic to guess indexes? You see indexes is incidental complexity here. We could avoid it if there would be smart enough system which could solve it. But there are a lot of factors, and it is hard to solve this problem in general (or maybe nobody tried, because we got used to the idea).

Collapse
 
bgadrian profile image
Adrian B.G.

I see so you are saying that SQL is an abstraction of data structures (databases), and the fact that we need to deal with indecs is a leak.

I see indecs are part of the SQL, as a data attribute, and also part of the technology that you have to use. Indeed not directly to the SQL language, but we dont use SQL, we use a database.

'Create table' or 'create index' is the same thing, you specify how do you want your data to be used, stored and retrived.