SlideShare a Scribd company logo
1 of 16
Often there is a situation where you have a base table, and you need to organize access to only
part of the records of this table. The best practice is to use secure views.
use role accountadmin;
create or replace share stocks_share;
show shares;
grant usage on database samples to share stocks_share;
grant usage on schema samples.finance to share stocks_share;
grant select on table samples.finance.stocks_data to share
stocks_share;
show grants to share stocks_share;
alter share stocks_share add accounts=<consumer_account>;
create database shared_db from share <provider_ account>.STOCKS_SHARE;
In some extreme cases for a large volume of data, we might use physical devices such as AWS
Snowball or Azure Data Box.
A specialty of the technical design of the Snowflake is that the data is stored in micro-partitions,1
which are immutable. This means that with any operations such as the addition or deletion of
data, a new micro-partition is created, and the old one ceases to exist. Using special commands
that extend standard SQL, you can easily access historical data.
Data retention for enterprise and level above is 90 days. For transient object, it’s a day. For
standard edition, it’s a day.
The parameter DATA_RETENTION_TIME_IN_DAYS can be set on the whole account or on the
object level, meaning database, schema, or table. According to this hierarchy, the parameter can
be overridden.
The statement SELECT with AT/BEFORE
• The user can request the version of the table by specifying the exact time (using keyword
TIMESTAMP)
SELECT * FROM <table> AT (TIMESTAMP => 'Mon, 05 Aug 2019 13:30:00 -0700'::timestamp);
For example, select historical data from a table of 30 minutes ago using this:
SELECT * FROM <table> AT (offset -60*30)
SELECT * FROM <table> BEFORE (STATEMENT => '<statement_id>');
show parameters like '%DATA_RETENTION%' in account;
alter account set DATA_RETENTION_TIME_IN_DAYS = 2;
show parameters like '%DATA%_RETENTION' in database samples;
alter database samples set DATA_RETENTION_TIME_IN_DAYS = 1;
create table samples.finance.stocks_10m clone samples.finance.stocks at (offset => -10*60);
Here 60 is second.
TIMESTAMP Alias for one of the TIMESTAMP variations (TIMESTAMP_NTZ by default).
TIMESTAMP_LTZ TIMESTAMP with local time zone; time zone, if provided, is not stored.
TIMESTAMP_NTZ TIMESTAMP with no time zone; time zone, if provided, is not stored.
TIMESTAMP_TZ TIMESTAMP with time zone.
Snowflake treats 'NaN' as greater than any other FLOAT value, including infinity.
The maximum length is 16 MB (uncompressed) for varchar. The maximum length is 8 MB for binary.
Synonymous with VARCHAR, except that if the length is not specified, CHAR(1) is the default.
Snowflake currently deviates from common CHAR semantics in that strings shorter than the maximum
length are not space-padded at the end.
'string with a ' character' = $$string with a ' character$$
select to_date ('2019-02-28') + INTERVAL '1 day, 1 year';
+---------------------------------------------------+
| TO_DATE ('2019-02-28') + INTERVAL '1 DAY, 1 YEAR' |
|---------------------------------------------------|
| 2020-03-01 |
+---------------------------------------------------+
select to_date('2018-04-15') + 1;
+---------------------------+
| TO_DATE('2018-04-15') + 1 |
|---------------------------|
| 2018-04-16 |
+---------------------------+
When we create a database, two schemas are auto created. Information_Schema
and Public. Information_Schema stores metadata about database like table,
sequence, views, procedure, functions, pipes and so on.
You can resize a warehouse size on the fly when it’s running. USE_WAREHOUSE command to
change warehouse in SQL editor.
// and -- is comment in Snowsql.
Multi cluster warehouse is also called elastic cluster.
Snowflake is HIPPA, SOC 1, 2 PCI DSS and FedRmap ready.
When you choose a cloud, you choose which provider your Snowflake account sits on top of. However, after
choosing your infrastructure provider, you do not interact with the cloud provider and you are not charged by the
min the management of your Snowflake account. Uses Azure storage and compute resources behind the scenes.
Uses AWS storage and compute resources behind the scenes. Uses GCP storage and compute resources
behind the scenes. With Snowflake, you interact only with the Service layer. The Service layer interacts with
Compute and Storage layers, which in turn interact with the underlying cloud infrastructure provider. Snowflake
Account Options & Assurances Cloud Platform Provider.
With Snowflake, you interact only with the Service layer. The Service layer interacts with Compute and Storage
layers, which in turn interact with the underlying cloud infrastructure provider. Generally speaking, customers will
want to choose a region close to their point of service. This reduces latency.
Availability Zones are replications of data within a region that are used to ensure that data is always available to
end users, even if one copy of the data becomes unavailable. Snowflake maintains data recovery and failsafe in
addition to the assurances provided by the cloud provider’s availability zone designs.
The Business Critical Edition adds encryption for all network movements and metadataSnowflake offers
continuous data protection.
Snowflake accounts use cloud availability zones for failover.
Snowflake accounts are easily replicated for regional failover
Snowflake accounts are easily replicated for cloud-provider failover
GCP was given as a cloud choice in 2020 (early)..
The SNOWFLAKEdatabase contains information about account usage. It is automatically added by Snowflake to
each new account. It is sometimes called the “Account Usage Share” because it is shared by Snowflake so
customers can check usage.
The SNOWFLAKE_SAMPLE_DATA is also shared by Snowflake. This database allows for performance testing
and tutorials. Customers are not charged for storing this data., because they are NOT storing it. The database is
a shared database.
SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY(Secure view) can give more than 14 days’ worth of
history.
If two users have fired the same query(with exact same text) and if their roles (like public, sysadmin) are same,
the data will be retrieved from result cache.
In VPC edition, sqls are also encypted. All keys are rotated annually.
History for load file – 64 days. History for snowpipe -14 days.
Variant & varchar can store upto 16 mb. Binary can do till 8 mb.
Unloading data only supports delimited (CSV etc), JSON and Parquet.

More Related Content

Similar to Snowflake Notes_Part_2.docx

Data power Performance Tuning
Data power Performance TuningData power Performance Tuning
Data power Performance TuningKINGSHUK MAJUMDER
 
Tech-Spark: Scaling Databases
Tech-Spark: Scaling DatabasesTech-Spark: Scaling Databases
Tech-Spark: Scaling DatabasesRalph Attard
 
Snowflake_Cheat_Sheet_Snowflake_Cheat_Sheet
Snowflake_Cheat_Sheet_Snowflake_Cheat_SheetSnowflake_Cheat_Sheet_Snowflake_Cheat_Sheet
Snowflake_Cheat_Sheet_Snowflake_Cheat_Sheetharipra2
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuningJugal Shah
 
My SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMy SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMarkus Flechtner
 
Best-Practices-for-Using-Tableau-With-Snowflake.pdf
Best-Practices-for-Using-Tableau-With-Snowflake.pdfBest-Practices-for-Using-Tableau-With-Snowflake.pdf
Best-Practices-for-Using-Tableau-With-Snowflake.pdfssuserf8f9b2
 
Advance Sql Server Store procedure Presentation
Advance Sql Server Store procedure PresentationAdvance Sql Server Store procedure Presentation
Advance Sql Server Store procedure PresentationAmin Uddin
 
CloudStack Metering - Working with Usage Data #CCCNA14
CloudStack Metering - Working with Usage Data #CCCNA14CloudStack Metering - Working with Usage Data #CCCNA14
CloudStack Metering - Working with Usage Data #CCCNA14ShapeBlue
 
Architetture Serverless con SQL Server e Azure Functions
Architetture Serverless con SQL Server e Azure FunctionsArchitetture Serverless con SQL Server e Azure Functions
Architetture Serverless con SQL Server e Azure FunctionsMassimo Bonanni
 
Database Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David IzahkDatabase Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David Izahksqlserver.co.il
 
05_DP_300T00A_Optimize.pptx
05_DP_300T00A_Optimize.pptx05_DP_300T00A_Optimize.pptx
05_DP_300T00A_Optimize.pptxKareemBullard1
 
Novidades do SQL Server 2016
Novidades do SQL Server 2016Novidades do SQL Server 2016
Novidades do SQL Server 2016Marcos Freccia
 
HTG-SQL Server 2005 - Backup & Recovery.pdf
HTG-SQL Server 2005 - Backup & Recovery.pdfHTG-SQL Server 2005 - Backup & Recovery.pdf
HTG-SQL Server 2005 - Backup & Recovery.pdfSami Asmar
 
DATASHEET▶ Enterprise Cloud Backup & Recovery with Symantec NetBackup
DATASHEET▶ Enterprise Cloud Backup & Recovery with Symantec NetBackupDATASHEET▶ Enterprise Cloud Backup & Recovery with Symantec NetBackup
DATASHEET▶ Enterprise Cloud Backup & Recovery with Symantec NetBackupSymantec
 
Whats New Sql Server 2008 R2 Cw
Whats New Sql Server 2008 R2 CwWhats New Sql Server 2008 R2 Cw
Whats New Sql Server 2008 R2 CwEduardo Castro
 
Introduction to snowflake
Introduction to snowflakeIntroduction to snowflake
Introduction to snowflakeSunil Gurav
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new featuresAjeet Singh
 

Similar to Snowflake Notes_Part_2.docx (20)

Data power Performance Tuning
Data power Performance TuningData power Performance Tuning
Data power Performance Tuning
 
Tech-Spark: Scaling Databases
Tech-Spark: Scaling DatabasesTech-Spark: Scaling Databases
Tech-Spark: Scaling Databases
 
Snowflake_Cheat_Sheet_Snowflake_Cheat_Sheet
Snowflake_Cheat_Sheet_Snowflake_Cheat_SheetSnowflake_Cheat_Sheet_Snowflake_Cheat_Sheet
Snowflake_Cheat_Sheet_Snowflake_Cheat_Sheet
 
SAS/Tableau integration
SAS/Tableau integrationSAS/Tableau integration
SAS/Tableau integration
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
 
My SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMy SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please help
 
Best-Practices-for-Using-Tableau-With-Snowflake.pdf
Best-Practices-for-Using-Tableau-With-Snowflake.pdfBest-Practices-for-Using-Tableau-With-Snowflake.pdf
Best-Practices-for-Using-Tableau-With-Snowflake.pdf
 
Advance Sql Server Store procedure Presentation
Advance Sql Server Store procedure PresentationAdvance Sql Server Store procedure Presentation
Advance Sql Server Store procedure Presentation
 
CloudStack Metering - Working with Usage Data #CCCNA14
CloudStack Metering - Working with Usage Data #CCCNA14CloudStack Metering - Working with Usage Data #CCCNA14
CloudStack Metering - Working with Usage Data #CCCNA14
 
Scaling apps using azure cloud services
Scaling apps using azure cloud servicesScaling apps using azure cloud services
Scaling apps using azure cloud services
 
Architetture Serverless con SQL Server e Azure Functions
Architetture Serverless con SQL Server e Azure FunctionsArchitetture Serverless con SQL Server e Azure Functions
Architetture Serverless con SQL Server e Azure Functions
 
Database Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David IzahkDatabase Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David Izahk
 
05_DP_300T00A_Optimize.pptx
05_DP_300T00A_Optimize.pptx05_DP_300T00A_Optimize.pptx
05_DP_300T00A_Optimize.pptx
 
Novidades do SQL Server 2016
Novidades do SQL Server 2016Novidades do SQL Server 2016
Novidades do SQL Server 2016
 
HTG-SQL Server 2005 - Backup & Recovery.pdf
HTG-SQL Server 2005 - Backup & Recovery.pdfHTG-SQL Server 2005 - Backup & Recovery.pdf
HTG-SQL Server 2005 - Backup & Recovery.pdf
 
Cloud SaaS FAQ
Cloud SaaS FAQCloud SaaS FAQ
Cloud SaaS FAQ
 
DATASHEET▶ Enterprise Cloud Backup & Recovery with Symantec NetBackup
DATASHEET▶ Enterprise Cloud Backup & Recovery with Symantec NetBackupDATASHEET▶ Enterprise Cloud Backup & Recovery with Symantec NetBackup
DATASHEET▶ Enterprise Cloud Backup & Recovery with Symantec NetBackup
 
Whats New Sql Server 2008 R2 Cw
Whats New Sql Server 2008 R2 CwWhats New Sql Server 2008 R2 Cw
Whats New Sql Server 2008 R2 Cw
 
Introduction to snowflake
Introduction to snowflakeIntroduction to snowflake
Introduction to snowflake
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new features
 

Recently uploaded

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 

Recently uploaded (20)

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 

Snowflake Notes_Part_2.docx

  • 1. Often there is a situation where you have a base table, and you need to organize access to only part of the records of this table. The best practice is to use secure views. use role accountadmin; create or replace share stocks_share; show shares; grant usage on database samples to share stocks_share; grant usage on schema samples.finance to share stocks_share; grant select on table samples.finance.stocks_data to share stocks_share; show grants to share stocks_share; alter share stocks_share add accounts=<consumer_account>; create database shared_db from share <provider_ account>.STOCKS_SHARE; In some extreme cases for a large volume of data, we might use physical devices such as AWS Snowball or Azure Data Box. A specialty of the technical design of the Snowflake is that the data is stored in micro-partitions,1 which are immutable. This means that with any operations such as the addition or deletion of data, a new micro-partition is created, and the old one ceases to exist. Using special commands that extend standard SQL, you can easily access historical data. Data retention for enterprise and level above is 90 days. For transient object, it’s a day. For standard edition, it’s a day. The parameter DATA_RETENTION_TIME_IN_DAYS can be set on the whole account or on the object level, meaning database, schema, or table. According to this hierarchy, the parameter can be overridden. The statement SELECT with AT/BEFORE • The user can request the version of the table by specifying the exact time (using keyword TIMESTAMP) SELECT * FROM <table> AT (TIMESTAMP => 'Mon, 05 Aug 2019 13:30:00 -0700'::timestamp); For example, select historical data from a table of 30 minutes ago using this: SELECT * FROM <table> AT (offset -60*30) SELECT * FROM <table> BEFORE (STATEMENT => '<statement_id>'); show parameters like '%DATA_RETENTION%' in account; alter account set DATA_RETENTION_TIME_IN_DAYS = 2; show parameters like '%DATA%_RETENTION' in database samples; alter database samples set DATA_RETENTION_TIME_IN_DAYS = 1; create table samples.finance.stocks_10m clone samples.finance.stocks at (offset => -10*60); Here 60 is second. TIMESTAMP Alias for one of the TIMESTAMP variations (TIMESTAMP_NTZ by default). TIMESTAMP_LTZ TIMESTAMP with local time zone; time zone, if provided, is not stored. TIMESTAMP_NTZ TIMESTAMP with no time zone; time zone, if provided, is not stored. TIMESTAMP_TZ TIMESTAMP with time zone. Snowflake treats 'NaN' as greater than any other FLOAT value, including infinity. The maximum length is 16 MB (uncompressed) for varchar. The maximum length is 8 MB for binary.
  • 2. Synonymous with VARCHAR, except that if the length is not specified, CHAR(1) is the default. Snowflake currently deviates from common CHAR semantics in that strings shorter than the maximum length are not space-padded at the end. 'string with a ' character' = $$string with a ' character$$ select to_date ('2019-02-28') + INTERVAL '1 day, 1 year'; +---------------------------------------------------+ | TO_DATE ('2019-02-28') + INTERVAL '1 DAY, 1 YEAR' | |---------------------------------------------------| | 2020-03-01 | +---------------------------------------------------+ select to_date('2018-04-15') + 1; +---------------------------+ | TO_DATE('2018-04-15') + 1 | |---------------------------| | 2018-04-16 | +---------------------------+ When we create a database, two schemas are auto created. Information_Schema and Public. Information_Schema stores metadata about database like table, sequence, views, procedure, functions, pipes and so on. You can resize a warehouse size on the fly when it’s running. USE_WAREHOUSE command to change warehouse in SQL editor. // and -- is comment in Snowsql. Multi cluster warehouse is also called elastic cluster.
  • 3.
  • 4.
  • 5.
  • 6. Snowflake is HIPPA, SOC 1, 2 PCI DSS and FedRmap ready. When you choose a cloud, you choose which provider your Snowflake account sits on top of. However, after choosing your infrastructure provider, you do not interact with the cloud provider and you are not charged by the min the management of your Snowflake account. Uses Azure storage and compute resources behind the scenes. Uses AWS storage and compute resources behind the scenes. Uses GCP storage and compute resources behind the scenes. With Snowflake, you interact only with the Service layer. The Service layer interacts with Compute and Storage layers, which in turn interact with the underlying cloud infrastructure provider. Snowflake Account Options & Assurances Cloud Platform Provider. With Snowflake, you interact only with the Service layer. The Service layer interacts with Compute and Storage layers, which in turn interact with the underlying cloud infrastructure provider. Generally speaking, customers will want to choose a region close to their point of service. This reduces latency. Availability Zones are replications of data within a region that are used to ensure that data is always available to end users, even if one copy of the data becomes unavailable. Snowflake maintains data recovery and failsafe in addition to the assurances provided by the cloud provider’s availability zone designs. The Business Critical Edition adds encryption for all network movements and metadataSnowflake offers continuous data protection. Snowflake accounts use cloud availability zones for failover. Snowflake accounts are easily replicated for regional failover Snowflake accounts are easily replicated for cloud-provider failover
  • 7. GCP was given as a cloud choice in 2020 (early).. The SNOWFLAKEdatabase contains information about account usage. It is automatically added by Snowflake to each new account. It is sometimes called the “Account Usage Share” because it is shared by Snowflake so customers can check usage. The SNOWFLAKE_SAMPLE_DATA is also shared by Snowflake. This database allows for performance testing and tutorials. Customers are not charged for storing this data., because they are NOT storing it. The database is a shared database.
  • 8.
  • 9.
  • 10.
  • 11. SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY(Secure view) can give more than 14 days’ worth of history.
  • 12.
  • 13. If two users have fired the same query(with exact same text) and if their roles (like public, sysadmin) are same, the data will be retrieved from result cache.
  • 14. In VPC edition, sqls are also encypted. All keys are rotated annually.
  • 15.
  • 16. History for load file – 64 days. History for snowpipe -14 days. Variant & varchar can store upto 16 mb. Binary can do till 8 mb. Unloading data only supports delimited (CSV etc), JSON and Parquet.