data-modeling

Database design - Approach for storing points for users

我怕爱的太早我们不能终老 提交于 2019-11-29 23:06:16
问题 Just looking for some suggestions on how to approach the database design for this. On my site a user can get points for performing different activities. Currently there are 3 activities for which I award points - but the design has to be scalable where I can add other activities for awarding points as well. So today - the user gets points 1) When he adds a new store he gets 10 points (Store information is stored in STORE table) 2) When he answers a question he gets 7 points (Questions/answers

In Neo4j, what level of specificity should be used when granularity level can be unlimited?

陌路散爱 提交于 2019-11-29 21:52:15
问题 The hardest thing to wrap my head around when using a graph database, is choosing level of granularity. Lets say I have a graph for things that occur at certain days of the week: trash day, taco tuesday, BYOB friday, etc. I can make each day a node (Mon, Tue, Wed, ...), that way, querying for specific days is fast. I can make a node called Day, and add the property name with the day of the week. That way, showing all days in a graph is easy to query for. Thinking to myself, making nodes very

Working with nested single queries in Firestore

馋奶兔 提交于 2019-11-29 19:53:46
Recently I moved my data model from Firebase to Firestore. All my code is working, but I'm having some ugly troubles regarding my nested queries for retrieve some data. Here is the point: Right now my data model for this part looks like this(Yes! Another followers/feed example): { "Users": { //Collection "UserId1" : { //Document "Feed" : { //Subcollection of Id of posts from users this user Follow "PostId1" : { //Document "timeStamp" : "SomeDate" }, "PostId2" : { "timeStamp" : "SomeDate" }, "PostId3" : { "timeStamp" : "SomeDate" } } //Some data } }, "Posts":{ //Collection "PostId1":{ /

Why many refer to Cassandra as a Column oriented database?

依然范特西╮ 提交于 2019-11-29 19:11:57
Reading several papers and documents on internet, I found many contradictory information about the Cassandra data model. There are many which identify it as a column oriented database, other as a row-oriented and then who define it as a hybrid way of both. According to what I know about how Cassandra stores file, it uses the *-Index.db file to access at the right position of the *-Data.db file where it is stored the bloom filter, column index and then the columns of the required row. In my opinion, this is strictly row-oriented. Is there something I'm missing? Yes, the "column-oriented"

Is using char as a primary/foreign key a no no?

点点圈 提交于 2019-11-29 18:49:11
问题 Consider that there is a bunch of tables which link to "countries" or "currencies" tables. For making data easier to read I'd like make CHAR field with country code (eg US, GB, AU) and currency code (USD, AUD) a primary keys in each of those 2 tables and all other tables will use this CHAR as a foregin key. Database is mysql with innodb engine. Is it going to cause performance issues? Is it something i should avoid? 回答1: Performance isn't really the main issue, at least not for me. The issue

Aggregation in Cassandra across partitions

烈酒焚心 提交于 2019-11-29 18:05:43
I have a Data model like below, CREATE TABLE appstat.nodedata ( nodeip text, timestamp timestamp, flashmode text, physicalusage int, readbw int, readiops int, totalcapacity int, writebw int, writeiops int, writelatency int, PRIMARY KEY (nodeip, timestamp) ) WITH CLUSTERING ORDER BY (timestamp DESC) where, nodeip - primary key and timestamp - clustering key (Sorted by descinding oder to get the latest), Sample data in this table, SELECT * from nodedata WHERE nodeip = '172.30.56.60' LIMIT 2; nodeip | timestamp | flashmode | physicalusage | readbw | readiops | totalcapacity | writebw | writeiops

How to model many blobs for an object?

不羁岁月 提交于 2019-11-29 17:59:25
I want to enable something like a one-to-many relation between a text object and blobs so that a text object (an "article" or likewise) has many images and/or videos. There are two ways I see how to do this where the first is using a list of blobs as instance variable. Will it work? class A(search.SearchableModel): blobs = db.ListProperty(blobstore.BlobReferenceProperty()) Advantages: Just one class. Readable and easy to get and set data. Disadvantages: Lacks extra info for blobs e.g. if I want to tag a blob with descriptive words I still need two classes instead: class A(search

Entity Framework CTP5 Code-First Mapping - Foreign Key in same table

て烟熏妆下的殇ゞ 提交于 2019-11-29 11:16:35
How would I map something like this using the modelBuilder? Where theres a nullable foreign key referencing the same tables primary key Table: Task taskID int pk taskName varchar parentTaskID int (nullable) FK Task class: public class Task { public int taskID {get;set;} public string taskName {get;set;} public int parentTaskID {get;set;} public Task parentTask {get;set;} } ... modelBuilder.Entity<Task>() .HasOptional(o => o.ParentTask).... The following code gives you the desired schema. Note that you also need to define ParentTaskID foreign key as a nullable integer, like I did below. public

Max Tables & Design Pattern

a 夏天 提交于 2019-11-29 08:54:18
I am working on an app right now which has the potential to grow quite large. The whole application runs through a single domain, with customers being given sub-domains, which means that it all, of course, runs through a common code-base. What I am struggling with is the database design. I am not sure if it would be better to have a column in each table specifying the customer id, or to create a new set of tables (in the same database), or to create a complete new database per customer. The nice thing about a "flag" in the database specifying the customer id is that everything is in a single

Sql recursion without recursion

那年仲夏 提交于 2019-11-29 06:57:46
I have four tables create table entities{ integer id; string name; } create table users{ integer id;//fk to entities string email; } create table groups{ integer id;//fk to entities } create table group_members{ integer group_id; //fk to group integer entity_id;//fk to entity } I want to make a query that returns all groups where a user belongs, directly or indirectly. The obvious solution is to make a recursion at the application level. I’m wondering what changes can I make to my data model to decrease the database access and as a result have a better performance. In Oracle : SELECT group_id