- Query optimizing framework
markdown
* scan reduction
* limiting volume of data read
* query re-writing
* join optimization
400 IQ
sql
-- If the query is eligible for query acceleration, the output includes the estimated query execution time for different query acceleration scale factors.
SYSTEM$ESTIMATE_QUERY_ACCELERATION( '<query_id>' )
-- Returns clustering information, including average clustering depth, for a table based on one or more columns in the table.
SYSTEM$CLUSTERING_INFORMATION( '<table_name>' [ , '( <expr1> [ , <expr2> ... ] )' ] )
-- Computes the average depth of the table according to the specified columns (or the clustering key defined for the table).
SYSTEM$CLUSTERING_DEPTH( '<table_name>' , '( <col1> [ , <col2> ... ] )' [ , '<predicate>' ] )
-- Given the text of a SQL statement, this function generates the EXPLAIN plan in JSON.
SYSTEM$EXPLAIN_PLAN_JSON( { <sql_statement_expression> | <sql_query_id_expression> } )
- Creating basic csv file format
sql
create or replace file format basic_csv
type = 'CSV'
field_delimiter = ','
skip_header = 1
null_if = ('NULL', 'null', 'NA', 'N/A', '?', 'na')
field_optionally_enclosed_by = '"'
empty_field_as_null = true;
- Create stage
sql
create or replace stage basic_stage
file_format = basic_csv
url = 's3://bucket-name/';
- Copying into table
sql
copy into schema.table_name
from @basic_stage/bucket-name/directory/
pattern = '*.csv';