databaseindexingcolumn-oriented

Why can't row-oriented DB make an indexing like the inherient column-oriented DB structure


From this wiki page: http://en.wikipedia.org/wiki/Column-oriented_DBMS

I got the impression that the reason why column oriented database retrieves records satisfying specific condition faster than an indexed row-oriented database is because of the mapping.

That is, an indexing of a column is stored as the following: 1: bot 2: human 3: bot

On the other hand, column oriented database stores a column like the following: bot: 1,3 human: 2

So, why can't a row-oriented database make an index like the column-oriented database.


Solution

  • A database software can store data in more than one format and often it does. For example with SQL Server you can have columnar and row-based indexes on the same table. It is therefore not true that a DBMS must decide to pick one format and not use the other.

    In fact it is possible to define such an index easily even with row-based indexes. Just index on IsBot, ID (assuming that the two columns in your example are named this way). This index can easily satisfy a query filtering on IsBot.