denormalization

How do I not normalize continuous data (INTS, FLOATS, DATETIME, …)?

冷暖自知 提交于 2019-12-31 04:48:07
问题 According to my understanding - and correct me if I'm wrong - "Normalization" is the process of removing the redundant data from the database-desing However, when I was trying to learn about database optimizing/tuning for performance, I encountered that Mr. Rick James recommend against normalizing continuous values such as (INTS, FLOATS, DATETIME, ...) "Normalize, but don't over-normalize." In particular, do not normalize datetimes or floats or other "continuous" values. source Sure purists

Denormalising a fully normalised table

£可爱£侵袭症+ 提交于 2019-12-25 03:49:26
问题 Can anyone advise on how to go about denormalising a fully normalised table? I've not been able to find much on it despite googling. Whenever a record is updated (though not inserted, but lets not worry about that now) in TableA a record is inserted into HistoryOfTableA with the values of the fields which have changed and an associated timestamp when it was carried out. eg. TableA fields: TableA_Id, FieldA, FieldB, FieldC, FieldD.... etc HistoryOfTableA records: HistID, TableA_Id,

snowflake sproc vs standalone sql

允我心安 提交于 2019-12-24 21:30:41
问题 I am thinking to create denormalized table for our BI purpose. While creating business logic from several tables i noticed queries perform better when denormalized table is updated in batches(sproc with multiple business logic SQL's) with merge statement as below. eg: sproc contains multiple SQL's like merge denormalized_data (select businesslogic1) merge denormalized_data (select businesslogic2) etc Is it better to include business logic in huge SQL or divide it so that each query handles

How to set array index of normalized data

▼魔方 西西 提交于 2019-12-24 12:46:13
问题 I am trying to normalize a dataset, update an array index, and then denormalize the data. I'd like to change a P.O. at on a header line and have the change propagate to a linked order. The data model is as follows: let numSet = 0; let numLine = 2; let data = [ { "order": { "po_no": "original-po" }, "items": [ { "header": { "po_no": "keep-this-value", "set_no": 0 }, "line": { "id": "A123", "line_no": 1 } }, { "header": { "po_no": "update-with-this-value", "set_no": 0 }, "line": { "id": "B234",

Most efficient way to move table rows from one table to another

Deadly 提交于 2019-12-24 03:37:05
问题 I've created a denormalized table that needs to be inserted/updated every hour. The process is rather involved from a data perspective, so i am looking for a recommend way to update the table without disrupting the users. i am thinking of having a separate table that my process inserts/updates to and once complete, need a way to push those changes to my live production table. any help would be great! 回答1: Another solution is to use multiple schemas and play switch-a-roo. I only prefer this

searching on array items on a DynamoDB table

不羁岁月 提交于 2019-12-23 20:01:03
问题 I need to understand how one can search attributes of a DynamoDB that is part of an array. So, in denormalising a table, say a person that has many email addresses. I would create an array into the person table to store email addresses. Now, as the email address is not part of the sort key, and if I need to perform a search on an email address to find the person record. I need to index the email attribute. Can I create an index on the email address, which is 1-many relationship with a person

Dealing with “hypernormalized” data

隐身守侯 提交于 2019-12-23 12:45:51
问题 My employer, a small office supply company, is switching suppliers and I am looking through their electronic content to come up with a robust database schema; our previous schema was pretty much just thrown together without any thought at all, and it's pretty much led to an unbearable data model with corrupt, inconsistent information. The new supplier's data is much better than the old one's, but their data is what I would call hypernormalized . For example, their product category structure

Is storing counts of database record redundant?

坚强是说给别人听的谎言 提交于 2019-12-21 11:21:13
问题 I'm using Rails and MySQL, and have an efficiency question based on row counting. I have a Project model that has_many :donations . I want to count the number of unique donors for a project. Is having a field in the projects table called num_donors , and incrementing it when a new donor is created a good idea? Or is something like @num_donors = Donor.count(:select => 'DISTINCT user_id') going to be similar or the same in terms of efficiency thanks to database optimization? Will this require

MySQL dynamic crosstab query: Selecting child records as additional columns

依然范特西╮ 提交于 2019-12-20 06:38:10
问题 I have three tables in a MySQL database: users(user_settings,setting_types) setting_types(id,name) user_settings(value,user_id,setting_type_id) I would like to denormalize these so that when I query the DB I get a result like this: User.id User.username setting_name_1 setting_name_2 etc... 1 Admin true false 2 User false false The issue at hand is that the setting type system is extensible: I don't necessarily know which settings a user is going to have ahead of time, so I can't hardcode them

What is a good way to denormalize a mysql database?

倾然丶 夕夏残阳落幕 提交于 2019-12-18 14:37:43
问题 I have a large database of normalized order data that is becoming very slow to query for reporting. Many of the queries that I use in reports join five or six tables and are having to examine tens or hundreds of thousands of lines. There are lots of queries and most have been optimized as much as possible to reduce server load and increase speed. I think it's time to start keeping a copy of the data in a denormalized format. Any ideas on an approach? Should I start with a couple of my worst