Questions tagged [snowflake-schema]

**Snowflake schema** is special case of the database Star Schema, where one or many dimension tables are normalized. This is often done for improving the performance in some cases of the Star Schema. When the dimension tables are completely normalized, the resulting structure resembles a snowflake with the fact tables in the middle.

Snowflake schema is a logical arrangement of tables in a multidimensional database in which the dimensions are expressed by more than one table. The dimension tables that relate to the facts table represent the smallest granularity of data-analysis. The other tables in the same dimension represent aggregators of dimension's individual elements. When a dimension is aggregated by several independent criteria, the diagram resembles the shape of a snowflake. Used in data warehouses.

Methods for creating Snowflake Schema out of Star Schema:

  • Partially or fully normalize one or many dimension tables, leaving other dimensions unchanged.
  • Partially or fully normalize all dimension tables.

When to use

Query performance takes the highest significance in a data warehouse and snowflaking can hamper the performance. It very useful for cases, when some attributes like demographic attributes are browsed more then the whole customer table itself. Another case is for precalculated summaries derived from a fact table. This helps not aggregating over and over again since the operation is expensive.

Advantages

Savings in the storage space. Normalized structures are having no insertion, deletion or update anomalies. Easier to update and maintain.

Disadvantages

Schemas are less intuitive, with higher complexity and abstraction. Difficult browsing through the contents for users. Additional joins - worse query performance in some cases.

Example

Having a fact table called "Sales" and dimension table called "Product". Assume there are 500000 product dimension rows. These products can fall under 10 brands. For running query for products, not indexed on brands, the query will have to search through 500000 rows to find all brands.

On the other hand, if the "Product" table partially normalized, separated on another table "Brand" the initial search query would need to go through just 10 rows on.

External links

893 questions
-1
votes
2 answers

Snowflake Caching

I have read in a few places that there are 3 levels of caching in Snowflake: Metadata cache. Maintained in the Global Service Layer. This includes metadata relating to micro-partitions such as the minimum and maximum values in a column, number of…
-1
votes
1 answer

ssis not showing all schemas or tables present in snowflake, after connecting it to snowflake through odbc driver

I have ssis software(Microsoft SQL Server 2017 Data Tools 15.9.2) installed on our machines. we are not able to see all schemas after connecting it to snowflake through odbc driver. although i am able to see all schemas on older version but due to…
-1
votes
1 answer

automating account updates - Windows function Problem - MYSQL / SNOWFLAKE

I have two tables that contains account and owners. Table 1 / CASE 1: create table table_acc( acc int, owner_id int, start_date date, end_date date); insert into table_acc values ( 1, 101, '2021-01-01', …
trillion
  • 1,207
  • 1
  • 5
  • 15
-1
votes
2 answers

using variable while inserting data into a table - snowflake procedure

i am inserting a query from a variable into log table , but it is throwing error as below. Failed: Code: 100183\n State: P0000\n Message: SQL compilation error: syntax error line 3 at position 33 unexpected 'MM'. syntax error line 7 at position…
BalajiAWS
  • 137
  • 1
  • 12
-1
votes
1 answer

How to connect two fact tables to one dimensional table

I have two fact tables (HistoricTable, ForecastTable). Both tables use a composite key that combines the productID and WeekID together. The ForecastTable has future weekID's & historic has previous ones. I want both of these ProductID's to reference…
-1
votes
1 answer

Can Snowflake stage Standalone without the help of any cloud or lock machine?

For staging in Snowflake, we need S3 AWS layer or Azure or Local machine. Instead of this, can we FTP a file from a source team directly to Snowflake internal storage, so that, from there the Snowpipe can the file and load to our Snowflake table. If…
-1
votes
2 answers

How to fetch only contents excluding brackets using sql query?

In the database, I have column name RESOLUTIONID where data looks like the following content. [ 20893016 ] [ 20893020 ] [ 20893013 ] I want to fetch only the contents like the below ones. 20893016 20893020 20893013 Please help me with this.
Gokkul
  • 57
  • 5
-1
votes
1 answer

ID_DETAILS column from the ab and bc tables as per the image shown

Table: AB AP_ID UPDT_BY_ID UPDT_DATE 9848 923 '2019-09-14 21:09' 3242 427 '2019-09-15 21:09' 7845 514 '2019-09-16 21:09' Table: BC AP_ID CREATED_BY_ID CREATED_DT 1234 123 '2019-08-21…
-1
votes
2 answers

How does Snowflake's storage work differently from normal relational database in the cloud, like SQL Server on Azure?

Further, how does Snowflake "columnarize" all its data? Nothing I've read has explained it well
-1
votes
4 answers

How can I remove characters in a string after a specific special character (~) in snowflake sql?

I am using Snowflake SQL. I would like to remove characters from a string after a special character ~. How can I do that? here is the whole scenario. Let me explain. I do have a string like 'CK#123456~fndkjfgdjkg'. Now, i want only the number after…
deeps
  • 33
  • 1
  • 6
-1
votes
2 answers

Data Warehouse schema : Star or Snowflake (case included)

I need a hand with a specific case for creating Data Warehouse schema for University. I've tried to create a [schema] https://i.stack.imgur.com/MAtZM.jpg but it looks like im going in wrong direction Case: University currently has 5 courses –…
Guardian
  • 23
  • 1
  • 1
  • 5
-2
votes
2 answers

snowflake getting everything except the last part SQL

When using snowflake I need everything except the last part of these: for example1 : xxx | YYY | XXX | asda | dasd12 | adasda I just need xxx | YYY | XXX | asda | dasd12 example2: 32131| Y\ZYY | XXX | asda | dasd12 | 213131 | adsadfd I just…
-2
votes
1 answer

try/catch in stored procedure ,snowflake

I am using SQL language to create sp in snowflake. how can I implement try, catch there? create or replace procedure test() returns varchar language SQL as $$ ---my code $$ where should i put my code inside try , its giving me error
-2
votes
2 answers

Json data insert into table in snowflake

1 [["id=13456,state=closed]"] 2 [["id=34566,state=closed]",["id=34567,state=open]" ] create table Staff_status (id int, status ? ) what should be the data type for status and want output in json format, How can I achieve it?
-2
votes
1 answer

Dates as an attribute in Star schema

All, It's been a while I built a DWH star schema, too much data vault nowadays :) Quick question. Can we use dates as an attributes in some dimensions? Such as in Product dimension, if we have product effective_date and retired_date, these can be…
Adi334
  • 107
  • 3
  • 9
1 2 3
59
60