SnowConvert AI - Redshift Functional Differences¶
SSC-FDM-RS0001¶
Data storage option is not supported in Snowflake. Data distribution is automatically handled by Snowflake.
Description¶
In Snowflake, it is not necessary to explicitly define SORTKEY and DISTSTYLE when migrating from Redshift because Snowflake’s architecture inherently manages data distribution and optimization. Snowflake automatically handles data partitioning and indexing, optimizing query performance without requiring manual configuration of these parameters.
Code Example¶
Input Code:¶
Redshift¶
Generated Code:¶
Snowflake¶
Best Practices¶
It is advisable to assess the use of
CLUSTER BYin Snowflake during migration from Redshift, as it may improve query performance by optimizing data locality for frequently queried columns.If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-FDM-RS0002¶
The performance of CLUSTER BY in Snowflake may vary compared to the performance of SORTKEY in Redshift.
Description¶
The SORTKEY (excluding SORTKEY AUTO) in Amazon Redshift are analogous to CLUSTER BY in Snowflake. However, performance implications may vary due to architectural differences between Redshift and Snowflake.
SORTKEYimproves performance by maintaining data in a sorted order based on specified columns. This is particularly beneficial for range queries and ordering operations.CLUSTER BYin Snowflake organizes data into blocks based on designated columns, aiding in filtering and aggregation tasks. However, it is less stringent about ordering compared toSORTKEY.
Understanding these mechanisms is crucial for optimizing performance in each respective platform.
Code Example¶
Input Code:¶
Redshift¶
Generated Code:¶
Snowflake¶
Best Practices¶
Benchmark after migration: Run representative queries on both platforms to compare performance, as
CLUSTER BYuses micro-partitioning rather than physical sort order.Consider automatic clustering: For large tables with frequent queries on specific columns, enable automatic clustering in Snowflake.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-FDM-RS0003¶
Pending SnowConvert AI translation for Redshift foreign key constraints.
Description¶
Pending SnowConvert AI translation for Redshift foreign key constraints. Snowflake supports foreign key constraints, but they are not enforced and serve only as referential integrity metadata. This is a SnowConvert AI limitation, not a Snowflake platform limitation.
Code Example¶
Input Code:¶
Redshift¶
Generated Code:¶
Snowflake¶
Best Practices¶
You can manually alter tables with Foreign Keys and add them.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-FDM-RS0004¶
It is possible that the date is wrong and Snowflake does not accept wrong dates
Description¶
In Snowflake, using TO_DATE with an invalid date string (like ‘20010631’) results in an error because it enforces strict validation, rejecting any non-existent dates. In contrast, Redshift’s TO_DATE can adjust such invalid dates to the nearest valid date (e.g., rolling June 31 to July 1) if the is_strict parameter is set to false. This difference highlights how Snowflake prioritizes data integrity by not automatically correcting invalid dates, while Redshift allows for more flexibility in date handling.
Code Example¶
Input Code:¶
Redshift¶
Generated Code:¶
Snowflake¶
Best Practices¶
Check that the date is valid in the TRY_TO_DATE().
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-FDM-RS0005¶
Redshift MERGE rejects duplicate source rows. Snowflake allows them, which may produce different results.
Description¶
In Redshift, the MERGE statement throws an error when the source table contains duplicate rows matching the join condition. Snowflake allows MERGE to execute with duplicate source rows, which may produce non-deterministic results when multiple source rows match the same target row.
Code Example¶
Input Code:¶
Redshift¶
Generated Code:¶
Snowflake¶
Best Practices¶
Deduplicate source data: Add a
QUALIFY ROW_NUMBER() OVER (PARTITION BY join_key ORDER BY ...) = 1to the source subquery to ensure each target row matches at most one source row.Validate results: After migration, compare
MERGEoutput row counts between Redshift and Snowflake to detect non-deterministic behavior.If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-FDM-RS0006¶
Called procedure contains usages of COMMIT/ROLLBACK. Modifying the current transaction in child scopes is not supported in Snowflake.
Description¶
In Redshift, it is allowed to use the statements COMMIT and ROLLBACK inside a procedure to make permanent or discard the changes on a transaction that was opened on an outer scope.
Snowflake works with the concept of scoped transactions, which treats each procedure call as a separate transaction, this limits the effects of the COMMIT and ROLLBACK statements to the scope of the procedure they are declared in.
The aforementioned functional difference will be warned with this FDM when calls to a procedure with COMMIT or ROLLBACK are detected by SnowConvert.
Code Example¶
Input Code:¶
Redshift¶
Generated Code:¶
Snowflake¶
Best Practices¶
Refactor transaction control: Move
COMMITandROLLBACKstatements into the outermost procedure or use scoped transactions where supported.Use caller’s rights: Ensure the calling procedure manages the transaction boundary, as Snowflake’s scoped transactions isolate child procedure changes.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-FDM-RS0007¶
DDL statements perform an automatic COMMIT in Snowflake. ROLLBACK will not undo DDL-committed changes.
Description¶
In Snowflake, DDL statements perform an automatic commit after their execution, making permanent all the changes in the current transaction, meaning they can not be discarded by a ROLLBACK.
When a ROLLBACK statement is found in a procedure that also contains a DDL statement, SnowConvert AI will generate this FDM to inform about the DDL autocommit behavior.
Code Example¶
Input Code:¶
Redshift¶
Generated Code:¶
Snowflake¶
Best Practices¶
Separate DDL from DML transactions: Move DDL statements outside the transaction block, or execute them before
BEGIN TRANSACTIONto avoid implicit commits affecting DML operations.Use conditional logic: If DDL creation is conditional, check for object existence with
IF NOT EXISTSto avoid unnecessary autocommits.If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-FDM-RS0008¶
Snowflake uses autocommit by default. The NONATOMIC option is not supported in Snowflake.
Description¶
In Redshift, the NONATOMIC option on CREATE PROCEDURE allows individual statements within the procedure to commit independently. In Snowflake, autocommit is the default behavior — each statement is automatically committed unless wrapped in an explicit BEGIN TRANSACTION block. The NONATOMIC keyword is removed during migration because Snowflake’s autocommit provides equivalent semantics.
Code Example¶
Input Code:¶
Redshift¶
Generated Code:¶
Snowflake¶
Best Practices¶
Verify transaction behavior: If the original Redshift procedure relied on
NONATOMICfor partial commits, test the migrated Snowflake procedure to confirm that autocommit provides the expected semantics.Add explicit transactions where needed: If you need atomic (all-or-nothing) behavior for a group of statements in Snowflake, wrap them in
BEGIN TRANSACTION…COMMIT.If you need more support, you can email us at snowconvert-support@snowflake.com