4 ms·
I'm wondering if we're talking about different things here. You're talking about vectors, which to me suggests an ordered collection of primitives. I'm talking
by jacques_chester 13y ago
I'm wondering if we're talking about different things here. You're talking about vectors, which to me suggests an ordered collection of primitives. I'm talking about sets of relations.
The main difference is that a relation is not a primitive. It is a tuple of primitives.
The point being that sometimes you care about those relations being ordered by date, sometimes by amount, sometimes by ID and so on and so forth. The database imposes no order on you and so you can impose one at will.
The database equivalent of maintaining order for every single-column selection is to have per-column indices.
Try that in production on a busy OLTP system and let me know how you go.
Where array/vector languages and SQL see eye-to-eye is in basically abolishing the loop and having a logical model where operations are applied simultaneously to whole collections.
From talking to you the difference is when order is imposed. In cases of time series analysis, where there are single numbers and a natural order, I see the value of array/vector languages (or one of the various proprietary temporal-SQL databases). But most problems of interest aren't vectors with a single natural order.
Incidentally, I don't see why you think the tax-bracket thing is such a killer case. Oh noes, a small join!
- 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.