database-design

PHP/MYSQL: Database Table For Email Notifications

这一生的挚爱 提交于 2021-02-20 02:52:49
问题 I want to notify users of changes on a site. Users are subscribed to different kinds of changes so I don't send all changes to all users. Here's what I am thinking: at t=0 (i.e. an if statement that checks that some table is empty) I basically have an SQL query that fetches the appropriate changes and mails to the appropriate users. I then populate a user_changes table which essentially stores what changes have been mailed to what users. Mailing is done with the php mail function Then at t>0

Relational database design to mongoDB/mongoose design

自作多情 提交于 2021-02-18 06:41:09
问题 I have recently started using mongoDB and mongoose for my new node.js application. Having only used relational databases before I am struggling to adapt to the mongoDB/noSQL way of thinking such as denormalization and lack of foreign key relationships. I have this relational database design: **Users Table** user_id username email password **Games Table** game_id game_name **Lobbies Table** lobby_id game_id lobby_name **Scores Table** user_id game_id score So, each lobby belongs to a game, and

SQL | Two Schemas Questions [closed]

一世执手 提交于 2021-02-17 07:17:10
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 days ago . Improve this question I'm new to the schema part of sql so trying to explore and have doubts on the following, there are two schemas S1 and S2 with table T1 in S1 and T2 in S2: If a user logins to S1 will he be able to the following: Access table T2 How will you grant access to T2

Postgres db design Normalize tables or Use Array Columns

亡梦爱人 提交于 2021-02-17 07:03:25
问题 Newbie trying to figure out the best way to design a Postgres db for the following use case scenario. There is an Account table for the business customers and there is a contacts table with a column relationship. account.pk_id, …. contacts.pk_id, contacts.fk_accountid … Thousands of different businesses in the Accounts table will be storing millions of contacts each in the Contacts table. Each contact record will over time belong to between 1 and 100 different categories, lists and products.

Notification and News Area by using Redis

纵然是瞬间 提交于 2021-02-11 18:16:17
问题 I have a photo album system which people can upload photos and interract with other users. I use mySql and Redis to handle traffic and store the data. In my system, users can follow other users, like photos, comment on them and upload new photos. In this scenario, I want to show all events from user's followings on their wall (like facebook timeline). For example, I follow users 30,40,50,60,70 and 80 ids. Whenever they add a new photo, I would like to see them on my wall. The problem is this

SCD 1 dimension without surrogate key

旧城冷巷雨未停 提交于 2021-02-11 14:49:12
问题 This reference to Kimball group state that all dimensions should have surrogate keys except some very predictable one like date diemnsion. I have exactly the same case as described at SCD Type 1 Wiki page: Technically, the surrogate key is not necessary, since the row will be unique by the natural key (Supplier_Code). Data are loaded from operational system without surrogate key, while I calculating surrogate key in ETL based on single and unique xxx_code column. SCD Type 1, full load. Are

Reduce database write on notification system or change approbate database?

两盒软妹~` 提交于 2021-02-11 13:50:49
问题 We have a web app which requires to send lots of notifications to users (over 1,000,000 notifications per day). We use Laravel and MySQL for the database. I loop through a group of users send notifications and save it to the database. Let's say if I want to send a group of 1000 users. The data will be written to the DB 1000 time. As I said, we have over 1,000,000 notifications per day, which take so many resources. What's the appropriate way to approach this problem? I should change to a new

Multi-tenancy: How do I delete a tenant?

落花浮王杯 提交于 2021-02-10 17:30:36
问题 I have a system with shared multitenancy, which means each table contains data for all tenants with a TenantId column to distinguish between them. Provisioning a new tenant is quick and easy, however now I'm facing a challenge with deleting a single tenant. Given that entities depend on each other for consistency, how do I delete a tenant easily from my database, while the system is in use by other tenants? The system uses SQL Server 2008 R2, if that helps. 回答1: If I got you right - this is

How do you ensure values from a logging table match objects in other tables ?

試著忘記壹切 提交于 2021-02-10 16:18:51
问题 I have three tables. Two basic tables listing objects and a third table logging changes in database. Here is an example. create table individual (ind_id integer, age integer, name varchar); create table organisation (org_id integer, city varchar, name varchar); create TABLE log_table (log_id integer, object_id integer, table_name varchar, information json, log_date date); I want to ensure that any row in the log_table corresponds to an existing object in either the individual table or the

How do you ensure values from a logging table match objects in other tables ?

☆樱花仙子☆ 提交于 2021-02-10 16:17:39
问题 I have three tables. Two basic tables listing objects and a third table logging changes in database. Here is an example. create table individual (ind_id integer, age integer, name varchar); create table organisation (org_id integer, city varchar, name varchar); create TABLE log_table (log_id integer, object_id integer, table_name varchar, information json, log_date date); I want to ensure that any row in the log_table corresponds to an existing object in either the individual table or the