Redshift RECORD Type, Usage and Examples

Similar to other procedural language, such as nzplsql, Redshift plpgsql supports RECORD variables. The Redshift RECORD type variable is similar to row types, but they have no predefined structure associated with it. Record type variables can be used inside Redshift stored procedures. They are used in selections or FOR loops to hold one row from a SELECT operation. Redshift RECORD Type Variable A RECORD in Redshift plpgsql is not a true data type, but only a placeholder. Record type variables assume the actual row structure of the row that they…

Continue ReadingRedshift RECORD Type, Usage and Examples
Comments Off on Redshift RECORD Type, Usage and Examples

Redshift Conditional Statements – IF, LOOP, WHILE, FOR, CONTINUE and EXIT

The Redshift SQL conditional statements are a useful and important part of the plpgsql language. You can use Redshift control structures to perform some critical decisions based on data and manipulate SQL data in a flexible and powerful way. In Redshift, you can use conditional statements to control the flow of execution of a SQL script based on conditions. You can use these Redshift conditional statements for data manipulation in your complex SQL queries. Redshift Conditional Statements The Redshift conditional control flow statements are categorized into two parts: Conditional control…

Continue ReadingRedshift Conditional Statements – IF, LOOP, WHILE, FOR, CONTINUE and EXIT
Comments Off on Redshift Conditional Statements – IF, LOOP, WHILE, FOR, CONTINUE and EXIT

Redshift Stored Procedure Return Result Set – Working Example

Redshift stored procedures are used to encapsulate business logic such as transformation, data validation, etc. You can also use the stored procedure to return the result set in your applications. Typically, stored procedure returns a unique value, it can also return result set in the form of cursor or temporary tables. In this article, we will check Redshift Stored Procedure Return Result set with an example. Redshift Stored Procedure Return Result Set Return records from the Redshift stored procedure is bit different compared to other postgreSQL databases such as Netezza.…

Continue ReadingRedshift Stored Procedure Return Result Set – Working Example
Comments Off on Redshift Stored Procedure Return Result Set – Working Example

How to Create and Use Redshift Cursor Variable? – Examples

Just like many other SQL procedural languages, the latest version of Redshift plpgsql supports cursor type variables. You can use a cursor to retrieve a few rows at a time from the result set of a larger query. You can use the cursor type inside Redshift stored procedures (SP). They are used in selections and FOR loops to hold one row from a SELECT operation. In this article, we will check how to create and use Redshift cursor variable inside your stored procedure. Redshift Cursor Variable As mentioned earlier, Redshift…

Continue ReadingHow to Create and Use Redshift Cursor Variable? – Examples
Comments Off on How to Create and Use Redshift Cursor Variable? – Examples

Redshift Dynamic SQL Queries and Examples

When you are working on the various data sources and different kind of SQL queries, there may be situations where you want to generate dynamic SQL queries dynamically based on your requirement. In Redshift you can PREPARE SQL statement and EXECUTE it. Redshift also support use of EXECUTE command in Redshift stored procedures. In this article, we will check Redshift Dynamic SQL Queries, how to PREPARE them and run using EXECUTE statements. The dynamic SQL in Redshift can be useful in many scenarios, such as when you need to execute…

Continue ReadingRedshift Dynamic SQL Queries and Examples
Comments Off on Redshift Dynamic SQL Queries and Examples

Redshift Connection Issues – Causes and Resolution

Redshift is a petabyte data warehouse provided by AWS cloud. If you have created Redshift cluster by default it will be publicly accessible. Amazon has taken a lot of measure to secure Redshift cluster from unforeseen events such as unauthorized access from the network. In this article, we will discuss common Redshift connection issues, causes and resolution. Redshift Connection Issues Accessing redshift from EC2 instance is easy as you don't have to take any security measures as EC2 instance is also created in the AWS cloud. But if you are…

Continue ReadingRedshift Connection Issues – Causes and Resolution
Comments Off on Redshift Connection Issues – Causes and Resolution

Working with Amazon Redshift Stored Procedure

Amazon Redshift supports stored procedures written in PL/pgSQL, a dialect of the PostgreSQL database language. Stored procedures in Redshift are used to encapsulate logic on the database side and can be executed by multiple client applications, improving code reusability and reducing the amount of duplicated code in your applications. In this article, we will check how to create a stored procedure in Redshift using simple examples. Amazon Redshift Stored Procedure Overview Amazon Redshift stored procedures are used to encapsulate the data migration, data validation and business specific logic's and same time…

Continue ReadingWorking with Amazon Redshift Stored Procedure
Comments Off on Working with Amazon Redshift Stored Procedure

Amazon Redshift Features – Benefits and uses

Amazon Reshift is one of its kind cloud data warehouse appliance on the AWS cloud. It is lightning-fast, Massively parallel processing (MPP), scalable data warehouse and data processing solutions without a massive investment in infrastructure. Redshift provides access to other tools like storage service S3, data lake, machine learning modules, etc. Amazon Redshift is a lot different compared to other MPP data warehouse appliances like Netezza, Greenplum, etc. In this article, we will check Amazon Redshift features, benefits and its uses. Amazon Redshift Features Redshift is a great Platform as…

Continue ReadingAmazon Redshift Features – Benefits and uses
Comments Off on Amazon Redshift Features – Benefits and uses

Redshift User Defined Functions Examples

Create a user defined function is one of the important features of Amazon Redshift cloud data warehouse. Amazon Redshift supports creating user defined functions. You can create custom user-defined functions (UDF) using either SQL SELECT statements or Python program. In this article, we will check Redshift user defined functions examples and how to create them. Redshift User Defined Functions User defined function (UDF) in Redshift provide a powerful way to perform complex data processing tasks within the Redshift database. They can provide more control and flexibility over data processing workflows, and…

Continue ReadingRedshift User Defined Functions Examples
Comments Off on Redshift User Defined Functions Examples

Redshift Column Compression Types – Compression Encoding

Amazon Redshift, is a fast, fully managed, petabyte-scale data warehousing service. Redshift supports various columnar compression encoding techniques. In this article we will check Redshift column compression types - Compression Encoding techniques for Redshift performance optimization. Amazon Redshift supports data compression for reducing the amount of disk storage used by a table. Amazon Redshift compression encoding can significantly reduce the storage required for a table and improve query performance by reducing I/O operations. The column compression in Redshift also helps storage optimization. Redshift Column Compression Types – Compression Encoding Columnar…

Continue ReadingRedshift Column Compression Types – Compression Encoding
Comments Off on Redshift Column Compression Types – Compression Encoding