2 ms·
> The database equivalent of maintaining order for every single-column selection is to have per-column indices. I guess that's where the misunderstanding comes
by beagle3 13y ago
> The database equivalent of maintaining order for every single-column selection is to have per-column indices.
I guess that's where the misunderstanding comes. In K/APL, every column has an implicit "natural index" - the first item has index 0, the second item has index 1, etc. The thing that is always guaranteed is that, in a result set, the natural indices of the different columns of the same tuple correspond.
Some operations guarantee a particular natural index order, but many do not. An additional index on the values that allows you to find an exact value (e.g. hash) or range of values (e.g. a b-tree) may or may not exist, just like in a relational database.
This "natural implicit index" does not take memory or anything to maintain, but it is useful.
> Try that in production on a busy OLTP system and let me know how you go.
ksql runs my queries approximately 100 times faster than optimized MySQL (using MyISAM - faster, but no acid guarantees; ksql is acid).
> Incidentally, I don't see why you think the tax-bracket thing is such a killer case. Oh noes, a small join!
That was just for known terminology, not knowing where you come from. I have tables with thousands of such brackets. And while I haven't tried Oracle or MS-SQL for them since 2006 or so, it was incredibly easy to confuse their optimizer into doing a complete cross product on those tables and filter it - which makes it takes a second per query instead of milliseconds when the query is optimized properly (or microseconds using K).
This is known as an "as-of" join in time-series queries, and any database without explicit support for it usually takes thousands of times more resources than needed for such a join.