This one of the ideas we have been attempting to realise in Eve (eg
http://www.lighttable.com/2014/07/18/imperative-thinking/). We separate the data model (expressed as relations) from the physical implementation of that model (one or more physical data structures per table that implement the queryable interface). The compiler is then responsible for deciding how to evaluate a given query, based on the available data-structures, indexes, hereustics and user hints.
It seems radical in a programming context but it is a pretty standard and well proven separation in the database world. My favourite work along this line is https://infosys.uni-saarland.de/publications/DJ11.pdf which defines the data model to be an append-only list of tuples and treats the creation of all other data-structures, indexes, views etc as part of a single global optimisation problem.