nosql

Create a table in Cassandra 1.2 with CQL3 where column names will be created at runtime

大兔子大兔子 提交于 2019-12-06 16:41:08
I want to store snapshots of an object in Apache Cassandra 1.2 Row key is the Object#ID and there will be a column for each snapshot. -------- latest -------- v2 -------- v1 id-122 100 -------- 50 -------- 66 -------- So column names are created dynamically at runtime. How to create the previous table in Cassandra 1.2 using CQL3 ? You would use the compound primary key feature of CQL3: CREATE TABLE foo ( object_id int, version int, value int, PRIMARY KEY (object_id, version)); In CQL3, Table schema is fixed. So you can't really get dynamic column names. For that you have to switch to CQL2. 来源:

newSQL 到底是什么?

旧时模样 提交于 2019-12-06 16:05:08
数据库发展至今已经有3代了: SQL,传统关系型数据库,例如 MySQL noSQL,例如 MongoDB newSQL SQL 的问题 互联网在本世纪初开始迅速发展,互联网应用的用户规模、数据量都越来越大,并且要求7X24小时在线。 传统关系型数据库在这种环境下成为了瓶颈,通常有2种解决方法: 升级服务器硬件 虽然提升了性能,但总有天花板。 数据分片,使用分布式集群结构 对单点数据库进行数据分片,存放到由廉价机器组成的分布式的集群里。 可扩展性更好了,但也带来了新的麻烦。 以前在一个库里的数据,现在跨了多个库,应用系统不能自己去多个库中操作,需要使用数据库分片中间件。 分片中间件做简单的数据操作时还好,但涉及到跨库join、跨库事务时就很头疼了,很多人干脆自己在业务层处理,复杂度较高。 noSQL 的优势与不足 后来 noSQL 出现了,放弃了传统SQL的强事务保证和关系模型,重点放在数据库的高可用性和可扩展性。 noSQL 的主要优势: 高可用性和可扩展性,自动分区,轻松扩展 不保证强一致性,性能大幅提升 没有关系模型的限制,极其灵活 noSQL 不保证强一致性,对于普通应用没问题,但还是有不少像金融一样的企业级应用有强一致性的需求。 而且 noSQL 不支持 SQL 语句,兼容性是个大问题,不同的 noSQL 数据库都有自己的 api 操作数据,比较复杂。 newSQL 特性

Compare array elements,remove the one with the lowest score

别来无恙 提交于 2019-12-06 15:31:57
问题 There are 200 documents in school db. I must remove each document which has "type":"homework" and the lowest score. { "_id" : 0, "name" : "aimee Zank", "scores" : [ { "type" : "exam", "score" : 1.463179736705023 }, { "type" : "quiz", "score" : 11.78273309957772 }, { "type" : "homework", "score" : 6.676176060654615 }, { "type" : "homework", "score" : 35.8740349954354 } ] } For example,here { "type" : "homework", "score" : 6.676176060654615 } must be removed as score = 6.6 < 35.8 I sorted all

ElasticSearch - date range condition should match EXACTLY one item from date range array

跟風遠走 提交于 2019-12-06 15:28:43
问题 I am planning to store million of airbnb type apartments availabilty in elasticsearch . Where availabilty is an array that contains nested objects ( availability type is nested ). And each of those objects have date range, in which that apartment is available. apartments = [ { "_id": "kjty873yhekrg789e7r0n87e", "first_available_date": "2016-06-21", "availability": [ { "start": "2016-06-21", "end": "2016-08-01" }, { "start": "2016-08-20", "end": "2016-08-28" }, { "start": "2016-10-03", "end":

CouchDB sort doesn't work

让人想犯罪 __ 提交于 2019-12-06 15:16:11
问题 I recently started using CouchDB but I have no success with the sort-option using mango query. My database is a simple person dataset and for this example I'd like to show all documents with the type "person" and sort it by the "firstName". { "selector": { "type": "person" }, "sort" : ["firstName"] } But it doesnt work. I just get the documents without any particular order. This is the list of my indexes: special: _id json: gender json: firstName json: lastName Is there something I forgot?

Migrate RDBMS to Cassandra

北战南征 提交于 2019-12-06 14:53:37
I have a RDBMS database with the following tables: Airport ( iata PK , airport, city, state, country, lat, long) cancellation_cause ( cod_cancellation PK , description) Manufaturer (id_manufacturer PK , manufacturer_name) Model (id_model PK , model_name, id_manufacturer FK ) Airline ( airline_code PK , description) airplane_type (id_AirplaneType PK , airplane_type) engine_type (id_engine PK , engine_type) Aircraft_type (id_aircraft PK , aircraft_type) Airplane (TailNumber PK , id_model FK, id_aircraft FK , airline_code FK , id_AirplaneType FK , id_engine FK, Issue_date, status, year) Flight

MongoDB : where is the limit between “few” and “many”?

拥有回忆 提交于 2019-12-06 14:47:10
I am coming from the relational database world (Rails / PostgreSQL) and transitioning to the NoSQL world (Meteor / MongoDB), so I am learning about denormalization, embedding and true links. It seems that, in many cases, choosing between various database schemas comes down to the number of documents that will be "related" to each others. In this video series , the author distinguishes: one-to-many relationships from one-to-few relationships many-to-many relationships from few-to-few relationships So, I am wondering: where is the limit between few and many ? I guess there may not be a hard

Connect Parse with external database?

旧时模样 提交于 2019-12-06 14:12:36
问题 I am working on project where it is build using traditional technologies like PHP, mysql and it is a web application. Now we want to build an app for mobile users on platform like Andoid, iOS. So we are thinking to connect MySql with Parse.com database. I know parse uses NoSql kind of database for storing objects. So my question is can we connect parse database to any other SQL database ? If yes then how we can do that ? EDIT @Luca laco I just created a new cloud function like you. which is

Cassandra Cluster - Specific Node - specific table high Dropped Mutations

杀马特。学长 韩版系。学妹 提交于 2019-12-06 14:02:44
My Compression strategy in Production was LZ4 Compression. But I modified it to Deflate For compression change, we had to use nodetool Upgradesstables to forcefully upgrade the compression strategy on all sstables But once upgradesstabloes command completed on all the 5 nodes in the cluster, My requests started to fail, both read and write The issue is traced to a specific node out of the 5 node cluster and to a spcific table on that node. My whole cluster has roughly same amount of data and configuration , but 1 node in particular goes down is misbehaving Output of nodetool status |/ State

Cloudant: No index exists for this sort, try indexing by the sort fields

妖精的绣舞 提交于 2019-12-06 13:59:23
问题 I have a problem that persists for a few days and I cannot solve it. I have a simple document in my database which looks like this: { "_id": "asd123", "_rev": "revidasd123", "type": "CUSTOM_TYPE", "position": 8, "title": "Short custom title" } When I try to make a sort by position , even if I have created an index for this field, I always get the same error: Error: no_usable_index. Reason: No index exists for this sort, try indexing by the sort fields . Here is the index: { "type": "json",