Installation
Install the Redshift connector:Configuration
The Redshift connector uses the PostgreSQL adapter, as Redshift is based on PostgreSQL.Configuration Parameters
Redshift cluster endpoint (e.g.,
my-cluster.abc123.us-west-2.redshift.amazonaws.com)Redshift port (default is 5439)
Database name to connect to
Database username
Database password
Default schema to use (sets
search_path)SSL mode:
require, verify-ca, or verify-fullSSL/TLS Configuration
Redshift requires SSL connections. The connector is configured to use SSL by default:connection.yaml
IAM Authentication
For IAM-based authentication, you can use temporary credentials generated by AWS:connection.yaml
Temporary IAM credentials must be refreshed before expiration. Consider using standard database users for long-running Evidence instances.
Features
Type Mapping
Redshift types are mapped to Evidence types:- Numbers: SMALLINT, INTEGER, BIGINT, DECIMAL, REAL, DOUBLE PRECISION
- Strings: VARCHAR, CHAR, TEXT
- Dates: DATE, TIMESTAMP, TIMESTAMPTZ
- Booleans: BOOLEAN
Redshift-Specific Considerations
- SUPER type: Complex data returned as strings
- Column names: Automatically converted to lowercase
- Distribution keys: Query performance is affected by table distribution; use appropriate sort and distribution keys
- Workload Management (WLM): Query performance depends on WLM queue configuration
Cursor-based Streaming
Results are streamed in batches (default 100,000 rows) for memory-efficient processing.Example Query
Create a SQL file in your Evidence project:queries/daily_events.sql
Performance Optimization
Use Distribution Keys
When querying large tables, leverage Redshift’s distribution keys:Use Sort Keys
Query tables using their sort keys for better performance:Avoid SELECT *
Specify only needed columns to reduce data transfer:Network Configuration
VPC Security Groups
Ensure your Redshift cluster’s security group allows inbound connections:- Go to AWS Console → Redshift → Clusters → Your Cluster
- Click on the VPC security group
- Add an inbound rule:
- Type: Custom TCP
- Port: 5439
- Source: Your Evidence instance IP or CIDR block
Publicly Accessible
For development, you may need to make your cluster publicly accessible:- Go to Cluster → Actions → Modify publicly accessible setting
- Enable “Publicly accessible”
Troubleshooting
Connection timeout
Connection timeout
- Verify the cluster endpoint and port are correct
- Check VPC security group rules allow your IP
- Ensure the cluster is in “Available” state
- Verify the cluster is publicly accessible (if connecting from outside AWS)
SSL connection errors
SSL connection errors
Redshift requires SSL connections. Ensure SSL is enabled:
Schema not found
Schema not found
Grant schema usage permissions:
Slow query performance
Slow query performance
- Use EXPLAIN to analyze query plans
- Check WLM queue configuration
- Ensure tables use appropriate distribution and sort keys
- Run VACUUM and ANALYZE on tables regularly