Is it possible to construct complex queries against noSQL DB

前端 未结 4 859
予麋鹿
予麋鹿 2021-02-07 15:33

I have been researching noSQL DB and have not been able to satisfactorily answer this for myself: Is it possible to construct complex queries against noSQL DB?

The type

4条回答
  •  耶瑟儿~
    2021-02-07 16:21

    In my opinion, you can do this in a document data store, such as MongoDB, but not easily in a key-value data store such as Cassandra. If you were to do it in a key-value data store, the composite key would have to identify all the queried data elements (columns). In other words, one instance would have to have all the query columns. This is possible. In a vanilla key-value store, there is one data element (column) per key but you can do it to support many. A key value store permits this because the value is just a string value and can contain what you want. I recommend multiple data elements (columns) per key but you would have to program for this. If instead you have the columns in different column instances, it would be very slow to search through the data vertically, even though the columns are ordered. The sample in your question has only one table. If you have multiple tables in relational, in key-value stores you would have to create a new column family to store the joined data and you would still have to have multiple data elements per key. However, it would have to be pre-loaded horizontally in one instance in one family by an ETL-like process. In other words, join the data before it is loaded into the key value store, and design the Cassandra data store to store the already-combined data in a column with multiple values. Or use data mining. I believe "big data analytics" are currently addressing this problem in key-value stores. Another example, less sophisticated than yours, is how in key-value stores can you produce a simple report of sales revenue and volume by customer by product by week?

提交回复
热议问题