Amazon Redshift Database Developer Guide
User Manual:
Open the PDF directly: View PDF .
Page Count: 1006 [warning: Documents this large are best viewed by clicking the View PDF Link!]
- Amazon Redshift
- Table of Contents
- Welcome
- Amazon Redshift System Overview
- Getting Started Using Databases
- Building a Proof of Concept for Amazon Redshift
- Amazon Redshift Best Practices
- Amazon Redshift Best Practices for Designing Tables
- Amazon Redshift Best Practices for Loading Data
- Take the Loading Data Tutorial
- Take the Tuning Table Design Tutorial
- Use a COPY Command to Load Data
- Use a Single COPY Command to Load from Multiple Files
- Split Your Load Data into Multiple Files
- Compress Your Data Files
- Use a Manifest File
- Verify Data Files Before and After a Load
- Use a Multi-Row Insert
- Use a Bulk Insert
- Load Data in Sort Key Order
- Load Data in Sequential Blocks
- Use Time-Series Tables
- Use a Staging Table to Perform a Merge (Upsert)
- Schedule Around Maintenance Windows
- Amazon Redshift Best Practices for Designing Queries
- Working with Recommendations from Amazon Redshift Advisor
- Viewing Amazon Redshift Advisor Recommendations in the Console
- Amazon Redshift Advisor Recommendations
- Compress Table Data
- Compress Amazon S3 File Objects Loaded by COPY
- Isolate Multiple Active Databases
- Reallocate Workload Management (WLM) Memory
- Skip Compression Analysis During COPY
- Split Amazon S3 Objects Loaded by COPY
- Update Table Statistics
- Enable Short Query Acceleration
- Replace Single-Column Interleaved Sort Keys
- Tutorial: Tuning Table Design
- Prerequisites
- Steps
- Step 1: Create a Test Data Set
- Step 2: Test System Performance to Establish a Baseline
- Step 3: Select Sort Keys
- Step 4: Select Distribution Styles
- Step 5: Review Compression Encodings
- Step 6: Recreate the Test Data Set
- Step 7: Retest System Performance After Tuning
- Step 8: Evaluate the Results
- Step 9: Clean Up Your Resources
- Summary
- Tutorial: Loading Data from Amazon S3
- Tutorial: Configuring Workload Management (WLM) Queues to Improve Query Processing
- Overview
- Section 1: Understanding the Default Queue Processing Behavior
- Section 2: Modifying the WLM Query Queue Configuration
- Section 3: Routing Queries to Queues Based on User Groups and Query Groups
- Section 4: Using wlm_query_slot_count to Temporarily Override Concurrency Level in a Queue
- Section 5: Cleaning Up Your Resources
- Tutorial: Querying Nested Data with Amazon Redshift Spectrum
- Managing Database Security
- Designing Tables
- Using Amazon Redshift Spectrum to Query External Data
- Amazon Redshift Spectrum Overview
- Getting Started with Amazon Redshift Spectrum
- IAM Policies for Amazon Redshift Spectrum
- Creating Data Files for Queries in Amazon Redshift Spectrum
- Creating External Schemas for Amazon Redshift Spectrum
- Creating External Tables for Amazon Redshift Spectrum
- Improving Amazon Redshift Spectrum Query Performance
- Monitoring Metrics in Amazon Redshift Spectrum
- Troubleshooting Queries in Amazon Redshift Spectrum
- Loading Data
- Using a COPY Command to Load Data
- Credentials and Access Permissions
- Preparing Your Input Data
- Loading Data from Amazon S3
- Loading Data from Amazon EMR
- Loading Data From Amazon EMR Process
- Step 1: Configure IAM Permissions
- Step 2: Create an Amazon EMR Cluster
- Step 3: Retrieve the Amazon Redshift Cluster Public Key and Cluster Node IP Addresses
- Step 4: Add the Amazon Redshift Cluster Public Key to Each Amazon EC2 Host's Authorized Keys File
- Step 5: Configure the Hosts to Accept All of the Amazon Redshift Cluster's IP Addresses
- Step 6: Run the COPY Command to Load the Data
- Loading Data from Remote Hosts
- Before You Begin
- Loading Data Process
- Step 1: Retrieve the Cluster Public Key and Cluster Node IP Addresses
- Step 2: Add the Amazon Redshift Cluster Public Key to the Host's Authorized Keys File
- Step 3: Configure the Host to Accept All of the Amazon Redshift Cluster's IP Addresses
- Step 4: Get the Public Key for the Host
- Step 5: Create a Manifest File
- Step 6: Upload the Manifest File to an Amazon S3 Bucket
- Step 7: Run the COPY Command to Load the Data
- Loading Data from an Amazon DynamoDB Table
- Verifying That the Data Was Loaded Correctly
- Validating Input Data
- Loading Tables with Automatic Compression
- Optimizing Storage for Narrow Tables
- Loading Default Column Values
- Troubleshooting Data Loads
- Updating Tables with DML Commands
- Updating and Inserting New Data
- Performing a Deep Copy
- Analyzing Tables
- Vacuuming Tables
- Managing Concurrent Write Operations
- Using a COPY Command to Load Data
- Unloading Data
- Creating User-Defined Functions
- Tuning Query Performance
- Query Processing
- Analyzing and Improving Queries
- Troubleshooting Queries
- Implementing Workload Management
- SQL Reference
- Amazon Redshift SQL
- Using SQL
- SQL Reference Conventions
- Basic Elements
- Names and Identifiers
- Literals
- Nulls
- Data Types
- Multibyte Characters
- Numeric Types
- Character Types
- Datetime Types
- Boolean Type
- Type Compatibility and Conversion
- Collation Sequences
- Expressions
- Conditions
- SQL Commands
- ABORT
- ALTER DATABASE
- ALTER DEFAULT PRIVILEGES
- ALTER GROUP
- ALTER SCHEMA
- ALTER TABLE
- ALTER TABLE APPEND
- ALTER USER
- ANALYZE
- ANALYZE COMPRESSION
- BEGIN
- CANCEL
- CLOSE
- COMMENT
- COMMIT
- COPY
- COPY Syntax
- COPY Syntax Overview
- COPY Parameter Reference
- Usage Notes
- COPY Examples
- Load FAVORITEMOVIES from an DynamoDB Table
- Load LISTING from an Amazon S3 Bucket
- Load LISTING from an Amazon EMR Cluster
- Using a Manifest to Specify Data Files
- Load LISTING from a Pipe-Delimited File (Default Delimiter)
- Load LISTING Using Columnar Data in Parquet Format
- Load LISTING Using Temporary Credentials
- Load EVENT with Options
- Load VENUE from a Fixed-Width Data File
- Load CATEGORY from a CSV File
- Load VENUE with Explicit Values for an IDENTITY Column
- Load TIME from a Pipe-Delimited GZIP File
- Load a Timestamp or Datestamp
- Load Data from a File with Default Values
- COPY Data with the ESCAPE Option
- Copy from JSON Examples
- Copy from Avro Examples
- Preparing Files for COPY with the ESCAPE Option
- CREATE DATABASE
- CREATE EXTERNAL SCHEMA
- CREATE EXTERNAL TABLE
- CREATE FUNCTION
- CREATE GROUP
- CREATE LIBRARY
- CREATE SCHEMA
- CREATE TABLE
- Syntax
- Parameters
- Usage Notes
- Examples
- Create a Table with a Distribution Key, a Compound Sort Key, and Compression
- Create a Table Using an Interleaved Sort Key
- Create a Table Using IF NOT EXISTS
- Create a Table with ALL Distribution
- Create a Table with Default EVEN Distribution
- Create a Temporary Table That Is LIKE Another Table
- Create a Table with an IDENTITY Column
- Create a Table with DEFAULT Column Values
- DISTSTYLE, DISTKEY, and SORTKEY Options
- CREATE TABLE AS
- CREATE USER
- CREATE VIEW
- DEALLOCATE
- DECLARE
- DELETE
- DROP DATABASE
- DROP FUNCTION
- DROP GROUP
- DROP LIBRARY
- DROP SCHEMA
- DROP TABLE
- DROP USER
- DROP VIEW
- END
- EXECUTE
- EXPLAIN
- FETCH
- GRANT
- INSERT
- LOCK
- PREPARE
- RESET
- REVOKE
- ROLLBACK
- SELECT
- SELECT INTO
- SET
- SET SESSION AUTHORIZATION
- SET SESSION CHARACTERISTICS
- SHOW
- START TRANSACTION
- TRUNCATE
- UNLOAD
- Syntax
- Parameters
- Usage Notes
- UNLOAD Examples
- Unload VENUE to a Pipe-Delimited File (Default Delimiter)
- Unload VENUE with a Manifest File
- Unload VENUE with MANIFEST VERBOSE
- Unload VENUE with a Header
- Unload VENUE to Smaller Files
- Unload VENUE Serially
- Load VENUE from Unload Files
- Unload VENUE to Encrypted Files
- Load VENUE from Encrypted Files
- Unload VENUE Data to a Tab-Delimited File
- Unload VENUE Using Temporary Credentials
- Unload VENUE to a Fixed-Width Data File
- Unload VENUE to a Set of Tab-Delimited GZIP-Compressed Files
- Unload Data That Contains a Delimiter
- Unload the Results of a Join Query
- Unload Using NULL AS
- ALLOWOVERWRITE Example
- UPDATE
- VACUUM
- SQL Functions Reference
- Leader Node–Only Functions
- Compute Node–Only Functions
- Aggregate Functions
- Bit-Wise Aggregate Functions
- Window Functions
- Window Function Syntax Summary
- AVG Window Function
- COUNT Window Function
- CUME_DIST Window Function
- DENSE_RANK Window Function
- FIRST_VALUE and LAST_VALUE Window Functions
- LAG Window Function
- LEAD Window Function
- LISTAGG Window Function
- MAX Window Function
- MEDIAN Window Function
- MIN Window Function
- NTH_VALUE Window Function
- NTILE Window Function
- PERCENT_RANK Window Function
- PERCENTILE_CONT Window Function
- PERCENTILE_DISC Window Function
- RANK Window Function
- RATIO_TO_REPORT Window Function
- ROW_NUMBER Window Function
- STDDEV_SAMP and STDDEV_POP Window Functions
- SUM Window Function
- VAR_SAMP and VAR_POP Window Functions
- Window Function Examples
- AVG Window Function Examples
- COUNT Window Function Examples
- CUME_DIST Window Function Examples
- DENSE_RANK Window Function Examples
- FIRST_VALUE and LAST_VALUE Window Function Examples
- LAG Window Function Examples
- LEAD Window Function Examples
- LISTAGG Window Function Examples
- MAX Window Function Examples
- MEDIAN Window Function Examples
- MIN Window Function Examples
- NTH_VALUE Window Function Examples
- NTILE Window Function Examples
- PERCENT_RANK Window Function Examples
- PERCENTILE_CONT Window Function Examples
- PERCENTILE_DISC Window Function Examples
- RANK Window Function Examples
- RATIO_TO_REPORT Window Function Examples
- ROW_NUMBER Window Function Example
- STDDEV_POP and VAR_POP Window Function Examples
- SUM Window Function Examples
- Unique Ordering of Data for Window Functions
- Conditional Expressions
- Date and Time Functions
- Summary of Date and Time Functions
- Summary of Date and Time Functions
- Date and Time Functions in Transactions
- Deprecated Leader Node-Only Functions
- ADD_MONTHS Function
- AT TIME ZONE Function
- CONVERT_TIMEZONE Function
- CURRENT_DATE Function
- DATE_CMP Function
- DATE_CMP_TIMESTAMP Function
- DATE_CMP_TIMESTAMPTZ Function
- DATE_PART_YEAR Function
- DATEADD Function
- DATEDIFF Function
- DATE_PART Function
- DATE_TRUNC Function
- EXTRACT Function
- GETDATE Function
- INTERVAL_CMP Function
- LAST_DAY Function
- MONTHS_BETWEEN Function
- NEXT_DAY Function
- SYSDATE Function
- TIMEOFDAY Function
- TIMESTAMP_CMP Function
- TIMESTAMP_CMP_DATE Function
- TIMESTAMP_CMP_TIMESTAMPTZ Function
- TIMESTAMPTZ_CMP Function
- TIMESTAMPTZ_CMP_DATE Function
- TIMESTAMPTZ_CMP_TIMESTAMP Function
- TIMEZONE Function
- TO_TIMESTAMP Function
- TRUNC Date Function
- Dateparts for Date or Time Stamp Functions
- Math Functions
- Mathematical Operator Symbols
- ABS Function
- ACOS Function
- ASIN Function
- ATAN Function
- ATAN2 Function
- CBRT Function
- CEILING (or CEIL) Function
- CHECKSUM Function
- COS Function
- COT Function
- DEGREES Function
- DEXP Function
- DLOG1 Function
- DLOG10 Function
- EXP Function
- FLOOR Function
- LN Function
- LOG Function
- MOD Function
- PI Function
- POWER Function
- RADIANS Function
- RANDOM Function
- ROUND Function
- SIN Function
- SIGN Function
- SQRT Function
- TAN Function
- TO_HEX Function
- TRUNC Function
- String Functions
- || (Concatenation) Operator
- BPCHARCMP Function
- BTRIM Function
- BTTEXT_PATTERN_CMP Function
- CHAR_LENGTH Function
- CHARACTER_LENGTH Function
- CHARINDEX Function
- CHR Function
- CONCAT (Oracle Compatibility Function)
- CRC32 Function
- FUNC_SHA1 Function
- INITCAP Function
- LEFT and RIGHT Functions
- LEN Function
- LENGTH Function
- LOWER Function
- LPAD and RPAD Functions
- LTRIM Function
- MD5 Function
- OCTET_LENGTH Function
- POSITION Function
- QUOTE_IDENT Function
- QUOTE_LITERAL Function
- REGEXP_COUNT Function
- REGEXP_INSTR Function
- REGEXP_REPLACE Function
- REGEXP_SUBSTR Function
- REPEAT Function
- REPLACE Function
- REPLICATE Function
- REVERSE Function
- RTRIM Function
- SPLIT_PART Function
- STRPOS Function
- STRTOL Function
- SUBSTRING Function
- TEXTLEN Function
- TRANSLATE Function
- TRIM Function
- UPPER Function
- JSON Functions
- Data Type Formatting Functions
- System Administration Functions
- System Information Functions
- CURRENT_DATABASE
- CURRENT_SCHEMA
- CURRENT_SCHEMAS
- CURRENT_USER
- CURRENT_USER_ID
- HAS_DATABASE_PRIVILEGE
- HAS_SCHEMA_PRIVILEGE
- HAS_TABLE_PRIVILEGE
- PG_BACKEND_PID
- PG_GET_COLS
- PG_GET_LATE_BINDING_VIEW_COLS
- PG_LAST_COPY_COUNT
- PG_LAST_COPY_ID
- PG_LAST_UNLOAD_ID
- PG_LAST_QUERY_ID
- PG_LAST_UNLOAD_COUNT
- SESSION_USER
- SLICE_NUM Function
- USER
- VERSION
- Reserved Words
- System Tables Reference
- System Tables and Views
- Types of System Tables and Views
- Visibility of Data in System Tables and Views
- STL Tables for Logging
- STL_AGGR
- STL_ALERT_EVENT_LOG
- STL_ANALYZE
- STL_BCAST
- STL_COMMIT_STATS
- STL_CONNECTION_LOG
- STL_DDLTEXT
- STL_DELETE
- STL_DISK_FULL_DIAG
- STL_DIST
- STL_ERROR
- STL_EXPLAIN
- STL_FILE_SCAN
- STL_HASH
- STL_HASHJOIN
- STL_INSERT
- STL_LIMIT
- STL_LOAD_COMMITS
- STL_LOAD_ERRORS
- STL_LOADERROR_DETAIL
- STL_MERGE
- STL_MERGEJOIN
- STL_NESTLOOP
- STL_PARSE
- STL_PLAN_INFO
- STL_PROJECT
- STL_QUERY
- STL_QUERY_METRICS
- STL_QUERYTEXT
- STL_REPLACEMENTS
- STL_RESTARTED_SESSIONS
- STL_RETURN
- STL_S3CLIENT
- STL_S3CLIENT_ERROR
- STL_SAVE
- STL_SCAN
- STL_SESSIONS
- STL_SORT
- STL_SSHCLIENT_ERROR
- STL_STREAM_SEGS
- STL_TR_CONFLICT
- STL_UNDONE
- STL_UNIQUE
- STL_UNLOAD_LOG
- STL_USERLOG
- STL_UTILITYTEXT
- STL_VACUUM
- STL_WINDOW
- STL_WLM_ERROR
- STL_WLM_RULE_ACTION
- STL_WLM_QUERY
- STV Tables for Snapshot Data
- STV_ACTIVE_CURSORS
- STV_BLOCKLIST
- STV_CURSOR_CONFIGURATION
- STV_EXEC_STATE
- STV_INFLIGHT
- STV_LOAD_STATE
- STV_LOCKS
- STV_PARTITIONS
- STV_QUERY_METRICS
- STV_RECENTS
- STV_SESSIONS
- STV_SLICES
- STV_STARTUP_RECOVERY_STATE
- STV_TBL_PERM
- STV_TBL_TRANS
- STV_WLM_QMR_CONFIG
- STV_WLM_CLASSIFICATION_CONFIG
- STV_WLM_QUERY_QUEUE_STATE
- STV_WLM_QUERY_STATE
- STV_WLM_QUERY_TASK_STATE
- STV_WLM_SERVICE_CLASS_CONFIG
- STV_WLM_SERVICE_CLASS_STATE
- System Views
- SVV_COLUMNS
- SVL_COMPILE
- SVV_DISKUSAGE
- SVV_EXTERNAL_COLUMNS
- SVV_EXTERNAL_DATABASES
- SVV_EXTERNAL_PARTITIONS
- SVV_EXTERNAL_SCHEMAS
- SVV_EXTERNAL_TABLES
- SVV_INTERLEAVED_COLUMNS
- SVL_QERROR
- SVL_QLOG
- SVV_QUERY_INFLIGHT
- SVL_QUERY_QUEUE_INFO
- SVL_QUERY_METRICS
- SVL_QUERY_METRICS_SUMMARY
- SVL_QUERY_REPORT
- SVV_QUERY_STATE
- SVL_QUERY_SUMMARY
- SVL_S3LOG
- SVL_S3PARTITION
- SVL_S3QUERY
- SVL_S3QUERY_SUMMARY
- SVL_S3RETRIES
- SVL_STATEMENTTEXT
- SVV_TABLES
- SVV_TABLE_INFO
- SVV_TRANSACTIONS
- SVL_USER_INFO
- SVL_UDF_LOG
- SVV_VACUUM_PROGRESS
- SVV_VACUUM_SUMMARY
- SVL_VACUUM_PERCENTAGE
- System Catalog Tables
- Configuration Reference
- Sample Database
- Appendix: Time Zone Names and Abbreviations
- Document History

Amazon Redshift
Database Developer Guide
API Version 2012-12-01

Amazon Redshift Database Developer Guide
Amazon Redshift: Database Developer Guide
Copyright © 2018 Amazon Web Services, Inc. and/or its affiliates. All rights reserved.
Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner
that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not
owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by
Amazon.

Amazon Redshift Database Developer Guide
Table of Contents
Welcome ........................................................................................................................................... 1
Are You a First-Time Amazon Redshift User? ................................................................................. 1
Are You a Database Developer? ................................................................................................... 2
Prerequisites .............................................................................................................................. 3
Amazon Redshift System Overview ...................................................................................................... 4
Data Warehouse System Architecture ........................................................................................... 4
Performance .............................................................................................................................. 6
Massively Parallel Processing .............................................................................................. 6
Columnar Data Storage ..................................................................................................... 7
Data Compression ............................................................................................................. 7
Query Optimizer ................................................................................................................ 7
Result Caching .................................................................................................................. 7
Compiled Code .................................................................................................................. 8
Columnar Storage ...................................................................................................................... 8
Internal Architecture and System Operation ................................................................................ 10
Workload Management ............................................................................................................. 11
Using Amazon Redshift with Other Services ................................................................................ 11
Moving Data Between Amazon Redshift and Amazon S3 ....................................................... 11
Using Amazon Redshift with Amazon DynamoDB ................................................................. 11
Importing Data from Remote Hosts over SSH ...................................................................... 11
Automating Data Loads Using AWS Data Pipeline ................................................................. 12
Migrating Data Using AWS Database Migration Service (AWS DMS) ......................................... 12
Getting Started Using Databases ........................................................................................................ 13
Step 1: Create a Database ......................................................................................................... 13
Step 2: Create a Database User .................................................................................................. 14
Delete a Database User ..................................................................................................... 14
Step 3: Create a Database Table ................................................................................................. 14
Insert Data Rows into a Table ............................................................................................ 15
Select Data from a Table ................................................................................................... 15
Step 4: Load Sample Data ......................................................................................................... 15
Step 5: Query the System Tables ............................................................................................... 16
View a List of Table Names ............................................................................................... 16
View Database Users ........................................................................................................ 17
View Recent Queries ......................................................................................................... 17
Determine the Process ID of a Running Query ..................................................................... 18
Step 6: Cancel a Query ............................................................................................................. 18
Cancel a Query from Another Session ................................................................................. 19
Cancel a Query Using the Superuser Queue ......................................................................... 19
Step 7: Clean Up Your Resources ................................................................................................ 20
Proof of Concept Playbook ................................................................................................................ 21
Identifying the Goals of the Proof of Concept .............................................................................. 21
Setting Up Your Proof of Concept .............................................................................................. 21
Designing and Setting Up Your Cluster ............................................................................... 22
Converting Your Schema and Setting Up the Datasets ........................................................... 22
Cluster Design Considerations .................................................................................................... 22
Amazon Redshift Evaluation Checklist ......................................................................................... 23
Benchmarking Your Amazon Redshift Evaluation .......................................................................... 24
Additional Resources ................................................................................................................. 25
Amazon Redshift Best Practices ......................................................................................................... 26
Best Practices for Designing Tables ............................................................................................. 26
Take the Tuning Table Design Tutorial ................................................................................ 27
Choose the Best Sort Key .................................................................................................. 27
Choose the Best Distribution Style ..................................................................................... 27
Use Automatic Compression .............................................................................................. 28
API Version 2012-12-01
iii

Amazon Redshift Database Developer Guide
Define Constraints ............................................................................................................ 28
Use the Smallest Possible Column Size ............................................................................... 28
Using Date/Time Data Types for Date Columns .................................................................... 29
Best Practices for Loading Data ................................................................................................. 29
Take the Loading Data Tutorial .......................................................................................... 29
Take the Tuning Table Design Tutorial ................................................................................ 29
Use a COPY Command to Load Data .................................................................................. 30
Use a Single COPY Command ............................................................................................ 30
Split Your Load Data into Multiple Files .............................................................................. 30
Compress Your Data Files .................................................................................................. 30
Use a Manifest File ........................................................................................................... 30
Verify Data Files Before and After a Load ............................................................................ 31
Use a Multi-Row Insert ..................................................................................................... 31
Use a Bulk Insert .............................................................................................................. 31
Load Data in Sort Key Order .............................................................................................. 31
Load Data in Sequential Blocks .......................................................................................... 32
Use Time-Series Tables ..................................................................................................... 32
Use a Staging Table to Perform a Merge ............................................................................. 32
Schedule Around Maintenance Windows ............................................................................. 32
Best Practices for Designing Queries ........................................................................................... 32
Working with Advisor ................................................................................................................ 34
Access Advisor ................................................................................................................. 34
Advisor Recommendations ................................................................................................. 35
Tutorial: Tuning Table Design ............................................................................................................. 45
Prerequisites ............................................................................................................................ 45
Steps ...................................................................................................................................... 45
Step 1: Create a Test Data Set ................................................................................................... 45
To Create a Test Data Set .................................................................................................. 46
Next Step ........................................................................................................................ 49
Step 2: Establish a Baseline ....................................................................................................... 49
To Test System Performance to Establish a Baseline ............................................................. 50
Next Step ........................................................................................................................ 52
Step 3: Select Sort Keys ............................................................................................................ 52
To Select Sort Keys .......................................................................................................... 53
Next Step ........................................................................................................................ 53
Step 4: Select Distribution Styles ............................................................................................... 53
Distribution Styles ............................................................................................................ 54
To Select Distribution Styles .............................................................................................. 54
Next Step ........................................................................................................................ 57
Step 5: Review Compression Encodings ....................................................................................... 57
To Review Compression Encodings ..................................................................................... 57
Next Step ........................................................................................................................ 59
Step 6: Recreate the Test Data Set ............................................................................................. 59
To Recreate the Test Data Set ............................................................................................ 60
Next Step ........................................................................................................................ 62
Step 7: Retest System Performance After Tuning ......................................................................... 62
To Retest System Performance After Tuning ........................................................................ 62
Next Step ........................................................................................................................ 66
Step 8: Evaluate the Results ...................................................................................................... 66
Next Step ........................................................................................................................ 68
Step 9: Clean Up Your Resources ................................................................................................ 68
Next Step ........................................................................................................................ 68
Summary ................................................................................................................................ 68
Next Step ........................................................................................................................ 69
Tutorial: Loading Data from Amazon S3 .............................................................................................. 70
Prerequisites ............................................................................................................................ 70
Overview ................................................................................................................................. 70
API Version 2012-12-01
iv

Amazon Redshift Database Developer Guide
Steps ...................................................................................................................................... 71
Step 1: Launch a Cluster ........................................................................................................... 71
Next Step ........................................................................................................................ 72
Step 2: Download the Data Files ................................................................................................ 72
Next Step ........................................................................................................................ 72
Step 3: Upload the Files to an Amazon S3 Bucket ........................................................................ 72
...................................................................................................................................... 73
Next Step ........................................................................................................................ 73
Step 4: Create the Sample Tables ............................................................................................... 74
Next Step ........................................................................................................................ 76
Step 5: Run the COPY Commands .............................................................................................. 76
COPY Command Syntax .................................................................................................... 76
Loading the SSB Tables ..................................................................................................... 77
Step 6: Vacuum and Analyze the Database .................................................................................. 87
Next Step ........................................................................................................................ 88
Step 7: Clean Up Your Resources ................................................................................................ 88
Next ............................................................................................................................... 88
Summary ................................................................................................................................ 88
Next Step ........................................................................................................................ 89
Tutorial: Configuring WLM Queues to Improve Query Processing ............................................................ 90
Overview ................................................................................................................................. 90
Prerequisites .................................................................................................................... 90
Sections .......................................................................................................................... 90
Section 1: Understanding the Default Queue Processing Behavior ................................................... 90
Step 1: Create the WLM_QUEUE_STATE_VW View ................................................................ 91
Step 2: Create the WLM_QUERY_STATE_VW View ................................................................. 92
Step 3: Run Test Queries ................................................................................................... 93
Section 2: Modifying the WLM Query Queue Configuration ............................................................ 94
Step 1: Create a Parameter Group ...................................................................................... 94
Step 2: Configure WLM ..................................................................................................... 95
Step 3: Associate the Parameter Group with Your Cluster ...................................................... 96
Section 3: Routing Queries to Queues Based on User Groups and Query Groups ................................ 98
Step 1: View Query Queue Configuration in the Database ...................................................... 98
Step 2: Run a Query Using the Query Group Queue .............................................................. 99
Step 3: Create a Database User and Group ........................................................................ 100
Step 4: Run a Query Using the User Group Queue .............................................................. 100
Section 4: Using wlm_query_slot_count to Temporarily Override Concurrency Level in a Queue ......... 101
Step 1: Override the Concurrency Level Using wlm_query_slot_count .................................... 102
Step 2: Run Queries from Different Sessions ...................................................................... 103
Section 5: Cleaning Up Your Resources ...................................................................................... 103
Tutorial: Querying Nested Data with Amazon Redshift Spectrum .......................................................... 104
Overview ............................................................................................................................... 104
Prerequisites .................................................................................................................. 104
Step 1: Create an External Table That Contains Nested Data ........................................................ 105
Step 2: Query Your Nested Data in Amazon S3 with SQL Extensions .............................................. 105
Extension 1: Access to Columns of Structs ......................................................................... 105
Extension 2: Ranging Over Arrays in a FROM Clause ............................................................ 106
Extension 3: Accessing an Array of Scalars Directly Using an Alias ......................................... 108
Extension 4: Accessing Elements of Maps .......................................................................... 108
Nested Data Use Cases ............................................................................................................ 109
Ingesting Nested Data ..................................................................................................... 109
Aggregating Nested Data with Subqueries ........................................................................ 109
Joining Amazon Redshift and Nested Data ........................................................................ 110
Nested Data Limitations .......................................................................................................... 111
Managing Database Security ............................................................................................................ 112
Amazon Redshift Security Overview .......................................................................................... 112
Default Database User Privileges .............................................................................................. 113
API Version 2012-12-01
v

Amazon Redshift Database Developer Guide
Superusers ............................................................................................................................. 113
Users ..................................................................................................................................... 114
Creating, Altering, and Deleting Users ............................................................................... 114
Groups .................................................................................................................................. 114
Creating, Altering, and Deleting Groups ............................................................................. 115
Schemas ................................................................................................................................ 115
Creating, Altering, and Deleting Schemas .......................................................................... 115
Search Path ................................................................................................................... 116
Schema-Based Privileges ................................................................................................. 116
Example for Controlling User and Group Access ......................................................................... 116
Designing Tables ............................................................................................................................ 118
Choosing a Column Compression Type ...................................................................................... 118
Compression Encodings ................................................................................................... 119
Testing Compression Encodings ........................................................................................ 125
Example: Choosing Compression Encodings for the CUSTOMER Table .................................... 127
Choosing a Data Distribution Style ........................................................................................... 129
Data Distribution Concepts .............................................................................................. 129
Distribution Styles .......................................................................................................... 130
Viewing Distribution Styles .............................................................................................. 131
Evaluating Query Patterns ............................................................................................... 132
Designating Distribution Styles ......................................................................................... 132
Evaluating the Query Plan ............................................................................................... 133
Query Plan Example ....................................................................................................... 134
Distribution Examples ..................................................................................................... 138
Choosing Sort Keys ................................................................................................................. 140
Compound Sort Key ........................................................................................................ 141
Interleaved Sort Key ....................................................................................................... 141
Comparing Sort Styles .................................................................................................... 142
Defining Constraints ............................................................................................................... 145
Analyzing Table Design ........................................................................................................... 146
Using Amazon Redshift Spectrum to Query External Data ................................................................... 148
Amazon Redshift Spectrum Overview ....................................................................................... 148
Amazon Redshift Spectrum Regions .................................................................................. 149
Amazon Redshift Spectrum Considerations ........................................................................ 149
Getting Started With Amazon Redshift Spectrum ....................................................................... 150
Prerequisites .................................................................................................................. 150
Steps ............................................................................................................................ 150
Step 1. Create an IAM Role .............................................................................................. 150
Step 2: Associate the IAM Role with Your Cluster ................................................................ 151
Step 3: Create an External Schema and an External Table .................................................... 152
Step 4: Query Your Data in Amazon S3 ............................................................................. 152
IAM Policies for Amazon Redshift Spectrum ............................................................................... 154
Amazon S3 Permissions ................................................................................................... 155
Cross-Account Amazon S3 Permissions .............................................................................. 156
Grant or Restrict Access Using Redshift Spectrum ............................................................... 156
Minimum Permissions ..................................................................................................... 157
Chaining IAM Roles ......................................................................................................... 158
Access AWS Glue Data .................................................................................................... 158
Creating Data Files for Queries in Amazon Redshift Spectrum ...................................................... 164
Creating External Schemas ...................................................................................................... 165
Working with External Catalogs ........................................................................................ 167
Creating External Tables .......................................................................................................... 171
Pseudocolumns .............................................................................................................. 172
Partitioning Redshift Spectrum External Tables .................................................................. 173
Mapping to ORC Columns ............................................................................................... 177
Improving Amazon Redshift Spectrum Query Performance .......................................................... 179
Monitoring Metrics .................................................................................................................. 181
API Version 2012-12-01
vi

Amazon Redshift Database Developer Guide
Troubleshooting Queries .......................................................................................................... 181
Retries Exceeded ............................................................................................................ 182
No Rows Returned for a Partitioned Table ......................................................................... 182
Not Authorized Error ....................................................................................................... 182
Incompatible Data Formats .............................................................................................. 182
Syntax Error When Using Hive DDL in Amazon Redshift ....................................................... 183
Permission to Create Temporary Tables ............................................................................. 183
Loading Data ................................................................................................................................. 184
Using COPY to Load Data ........................................................................................................ 184
Credentials and Access Permissions ................................................................................... 185
Preparing Your Input Data ............................................................................................... 186
Loading Data from Amazon S3 ........................................................................................ 187
Loading Data from Amazon EMR ...................................................................................... 196
Loading Data from Remote Hosts ..................................................................................... 200
Loading from Amazon DynamoDB .................................................................................... 206
Verifying That the Data Was Loaded Correctly ................................................................... 208
Validating Input Data ...................................................................................................... 208
Automatic Compression ................................................................................................... 209
Optimizing for Narrow Tables .......................................................................................... 211
Default Values ................................................................................................................ 211
Troubleshooting ............................................................................................................. 211
Updating with DML ................................................................................................................ 216
Updating and Inserting ........................................................................................................... 216
Merge Method 1: Replacing Existing Rows ......................................................................... 216
Merge Method 2: Specifying a Column List ........................................................................ 217
Creating a Temporary Staging Table ................................................................................. 217
Performing a Merge Operation by Replacing Existing Rows .................................................. 217
Performing a Merge Operation by Specifying a Column List ................................................. 218
Merge Examples ............................................................................................................. 219
Performing a Deep Copy ......................................................................................................... 221
Analyzing Tables .................................................................................................................... 223
Analyzing Tables ............................................................................................................ 223
Analysis of New Table Data ............................................................................................. 224
ANALYZE Command History ............................................................................................. 227
Vacuuming Tables ................................................................................................................... 228
VACUUM Frequency ........................................................................................................ 228
Sort Stage and Merge Stage ............................................................................................ 229
Vacuum Threshold .......................................................................................................... 229
Vacuum Types ................................................................................................................ 229
Managing Vacuum Times ................................................................................................. 230
Vacuum Column Limit Exceeded Error ............................................................................... 236
Managing Concurrent Write Operations ..................................................................................... 238
Serializable Isolation ....................................................................................................... 238
Write and Read-Write Operations ..................................................................................... 239
Concurrent Write Examples .............................................................................................. 240
Unloading Data .............................................................................................................................. 242
Unloading Data to Amazon S3 ................................................................................................. 242
Unloading Encrypted Data Files ................................................................................................ 245
Unloading Data in Delimited or Fixed-Width Format ................................................................... 246
Reloading Unloaded Data ........................................................................................................ 247
Creating User-Defined Functions ...................................................................................................... 248
UDF Security and Privileges ..................................................................................................... 248
Creating a Scalar SQL UDF ...................................................................................................... 248
Scalar SQL Function Example ........................................................................................... 249
Creating a Scalar Python UDF .................................................................................................. 249
Scalar Python UDF Example ............................................................................................. 250
Python UDF Data Types .................................................................................................. 250
API Version 2012-12-01
vii

Amazon Redshift Database Developer Guide
ANYELEMENT Data Type ................................................................................................. 251
Python Language Support ............................................................................................... 251
UDF Constraints ............................................................................................................. 254
Naming UDFs ......................................................................................................................... 254
Overloading Function Names ........................................................................................... 255
Preventing UDF Naming Conflicts ..................................................................................... 255
Logging Errors and Warnings ................................................................................................... 255
Tuning Query Performance .............................................................................................................. 257
Query Processing .................................................................................................................... 257
Query Planning And Execution Workflow ........................................................................... 257
Reviewing Query Plan Steps ............................................................................................ 259
Query Plan .................................................................................................................... 260
Factors Affecting Query Performance ................................................................................ 266
Analyzing and Improving Queries ............................................................................................. 267
Query Analysis Workflow ................................................................................................. 267
Reviewing Query Alerts ................................................................................................... 268
Analyzing the Query Plan ................................................................................................ 269
Analyzing the Query Summary ......................................................................................... 270
Improving Query Performance ......................................................................................... 275
Diagnostic Queries for Query Tuning ................................................................................. 277
Troubleshooting Queries .......................................................................................................... 280
Connection Fails ............................................................................................................. 281
Query Hangs .................................................................................................................. 281
Query Takes Too Long .................................................................................................... 282
Load Fails ...................................................................................................................... 283
Load Takes Too Long ...................................................................................................... 283
Load Data Is Incorrect ..................................................................................................... 283
Setting the JDBC Fetch Size Parameter ............................................................................. 284
Implementing Workload Management ............................................................................................... 285
Defining Query Queues ........................................................................................................... 285
Concurrency Level .......................................................................................................... 286
User Groups ................................................................................................................... 287
Query Groups ................................................................................................................ 287
Wildcards ....................................................................................................................... 287
WLM Memory Percent to Use ........................................................................................... 288
WLM Timeout ................................................................................................................ 288
Query Monitoring Rules .................................................................................................. 288
WLM Query Queue Hopping .................................................................................................... 288
WLM Timeout Queue Hopping ......................................................................................... 289
WLM Timeout Reassigned and Restarted Queries ................................................................ 289
QMR Hop Action Queue Hopping ..................................................................................... 289
QMR Hop Action Reassigned and Restarted Queries ............................................................ 290
WLM Query Queue Hopping Summary .............................................................................. 290
Short Query Acceleration ........................................................................................................ 291
Maximum SQA Run Time ................................................................................................. 292
Monitoring SQA .............................................................................................................. 292
Modifying the WLM Configuration ............................................................................................ 293
WLM Queue Assignment Rules ................................................................................................. 293
Queue Assignments Example ........................................................................................... 295
Assigning Queries to Queues ................................................................................................... 296
Assigning Queries to Queues Based on User Groups ............................................................ 296
Assigning a Query to a Query Group ................................................................................. 296
Assigning Queries to the Superuser Queue ........................................................................ 297
Dynamic and Static Properties ................................................................................................. 297
WLM Dynamic Memory Allocation .................................................................................... 298
Dynamic WLM Example ................................................................................................... 298
Query Monitoring Rules .......................................................................................................... 299
API Version 2012-12-01
viii

Amazon Redshift Database Developer Guide
Defining a Query Monitor Rule ......................................................................................... 300
Query Monitoring Metrics ................................................................................................ 301
Query Monitoring Rules Templates ................................................................................... 302
System Tables and Views for Query Monitoring Rules ......................................................... 303
WLM System Tables and Views ................................................................................................ 304
SQL Reference ............................................................................................................................... 306
Amazon Redshift SQL ............................................................................................................. 306
SQL Functions Supported on the Leader Node ................................................................... 306
Amazon Redshift and PostgreSQL .................................................................................... 307
Using SQL ............................................................................................................................. 312
SQL Reference Conventions ............................................................................................. 312
Basic Elements ............................................................................................................... 313
Expressions .................................................................................................................... 337
Conditions ..................................................................................................................... 340
SQL Commands ...................................................................................................................... 357
ABORT .......................................................................................................................... 359
ALTER DATABASE ........................................................................................................... 360
ALTER DEFAULT PRIVILEGES ............................................................................................ 361
ALTER GROUP ................................................................................................................ 363
ALTER SCHEMA .............................................................................................................. 364
ALTER TABLE ................................................................................................................. 365
ALTER TABLE APPEND ..................................................................................................... 374
ALTER USER ................................................................................................................... 377
ANALYZE ....................................................................................................................... 380
ANALYZE COMPRESSION ................................................................................................. 382
BEGIN ........................................................................................................................... 384
CANCEL ......................................................................................................................... 385
CLOSE ........................................................................................................................... 387
COMMENT ..................................................................................................................... 388
COMMIT ........................................................................................................................ 389
COPY ............................................................................................................................ 390
CREATE DATABASE .......................................................................................................... 448
CREATE EXTERNAL SCHEMA ............................................................................................ 449
CREATE EXTERNAL TABLE ................................................................................................ 452
CREATE FUNCTION ......................................................................................................... 463
CREATE GROUP .............................................................................................................. 467
CREATE LIBRARY ............................................................................................................ 468
CREATE SCHEMA ............................................................................................................ 470
CREATE TABLE ............................................................................................................... 471
CREATE TABLE AS ........................................................................................................... 483
CREATE USER ................................................................................................................. 490
CREATE VIEW ................................................................................................................. 493
DEALLOCATE .................................................................................................................. 496
DECLARE ....................................................................................................................... 496
DELETE ......................................................................................................................... 499
DROP DATABASE ............................................................................................................ 500
DROP FUNCTION ............................................................................................................ 501
DROP GROUP ................................................................................................................ 502
DROP LIBRARY ............................................................................................................... 502
DROP SCHEMA ............................................................................................................... 503
DROP TABLE .................................................................................................................. 504
DROP USER ................................................................................................................... 507
DROP VIEW ................................................................................................................... 508
END .............................................................................................................................. 509
EXECUTE ....................................................................................................................... 510
EXPLAIN ........................................................................................................................ 511
FETCH ........................................................................................................................... 515
API Version 2012-12-01
ix

Amazon Redshift Database Developer Guide
GRANT .......................................................................................................................... 516
INSERT .......................................................................................................................... 520
LOCK ............................................................................................................................ 524
PREPARE ....................................................................................................................... 525
RESET ........................................................................................................................... 527
REVOKE ......................................................................................................................... 527
ROLLBACK ..................................................................................................................... 531
SELECT .......................................................................................................................... 532
SELECT INTO .................................................................................................................. 560
SET ............................................................................................................................... 560
SET SESSION AUTHORIZATION ........................................................................................ 563
SET SESSION CHARACTERISTICS ....................................................................................... 564
SHOW ........................................................................................................................... 564
START TRANSACTION ...................................................................................................... 565
TRUNCATE ..................................................................................................................... 565
UNLOAD ........................................................................................................................ 566
UPDATE ......................................................................................................................... 580
VACUUM ........................................................................................................................ 584
SQL Functions Reference ......................................................................................................... 588
Leader Node–Only Functions ........................................................................................... 588
Compute Node–Only Functions ........................................................................................ 589
Aggregate Functions ....................................................................................................... 590
Bit-Wise Aggregate Functions .......................................................................................... 605
Window Functions .......................................................................................................... 610
Conditional Expressions ................................................................................................... 654
Date and Time Functions ................................................................................................. 663
Math Functions .............................................................................................................. 700
String Functions ............................................................................................................. 724
JSON Functions .............................................................................................................. 761
Data Type Formatting Functions ....................................................................................... 767
System Administration Functions ...................................................................................... 777
System Information Functions .......................................................................................... 780
Reserved Words ...................................................................................................................... 794
System Tables Reference ................................................................................................................. 797
System Tables and Views ......................................................................................................... 797
Types of System Tables and Views ............................................................................................ 797
Visibility of Data in System Tables and Views ............................................................................. 798
Filtering System-Generated Queries .................................................................................. 798
STL Tables for Logging ........................................................................................................... 798
STL_AGGR ..................................................................................................................... 800
STL_ALERT_EVENT_LOG .................................................................................................. 801
STL_ANALYZE ................................................................................................................. 803
STL_BCAST .................................................................................................................... 805
STL_COMMIT_STATS ....................................................................................................... 806
STL_CONNECTION_LOG ................................................................................................... 807
STL_DDLTEXT ................................................................................................................. 808
STL_DELETE ................................................................................................................... 810
STL_DISK_FULL_DIAG ...................................................................................................... 812
STL_DIST ....................................................................................................................... 812
STL_ERROR .................................................................................................................... 813
STL_EXPLAIN ................................................................................................................. 814
STL_FILE_SCAN .............................................................................................................. 816
STL_HASH ..................................................................................................................... 817
STL_HASHJOIN ............................................................................................................... 819
STL_INSERT ................................................................................................................... 820
STL_LIMIT ...................................................................................................................... 821
STL_LOAD_COMMITS ...................................................................................................... 823
API Version 2012-12-01
x

Amazon Redshift Database Developer Guide
STL_LOAD_ERRORS ......................................................................................................... 825
STL_LOADERROR_DETAIL ................................................................................................ 827
STL_MERGE ................................................................................................................... 829
STL_MERGEJOIN ............................................................................................................. 830
STL_NESTLOOP .............................................................................................................. 831
STL_PARSE .................................................................................................................... 832
STL_PLAN_INFO ............................................................................................................. 833
STL_PROJECT ................................................................................................................. 835
STL_QUERY .................................................................................................................... 837
STL_QUERY_METRICS ...................................................................................................... 838
STL_QUERYTEXT ............................................................................................................ 841
STL_REPLACEMENTS ....................................................................................................... 842
STL_RESTARTED_SESSIONS ............................................................................................. 843
STL_RETURN .................................................................................................................. 844
STL_S3CLIENT ................................................................................................................ 845
STL_S3CLIENT_ERROR ..................................................................................................... 847
STL_SAVE ...................................................................................................................... 848
STL_SCAN ...................................................................................................................... 849
STL_SESSIONS ............................................................................................................... 851
STL_SORT ...................................................................................................................... 852
STL_SSHCLIENT_ERROR ................................................................................................... 853
STL_STREAM_SEGS ......................................................................................................... 854
STL_TR_CONFLICT .......................................................................................................... 855
STL_UNDONE ................................................................................................................. 856
STL_UNIQUE .................................................................................................................. 856
STL_UNLOAD_LOG .......................................................................................................... 858
STL_USERLOG ................................................................................................................ 859
STL_UTILITYTEXT ........................................................................................................... 860
STL_VACUUM ................................................................................................................. 862
STL_WINDOW ................................................................................................................ 864
STL_WLM_ERROR ........................................................................................................... 865
STL_WLM_RULE_ACTION ................................................................................................. 866
STL_WLM_QUERY ........................................................................................................... 866
STV Tables for Snapshot Data .................................................................................................. 868
STV_ACTIVE_CURSORS .................................................................................................... 869
STV_BLOCKLIST ............................................................................................................. 869
STV_CURSOR_CONFIGURATION ........................................................................................ 872
STV_EXEC_STATE ............................................................................................................ 873
STV_INFLIGHT ................................................................................................................ 874
STV_LOAD_STATE ........................................................................................................... 875
STV_LOCKS .................................................................................................................... 876
STV_PARTITIONS ............................................................................................................ 877
STV_QUERY_METRICS ..................................................................................................... 879
STV_RECENTS ................................................................................................................ 882
STV_SESSIONS ............................................................................................................... 883
STV_SLICES ................................................................................................................... 884
STV_STARTUP_RECOVERY_STATE ..................................................................................... 885
STV_TBL_PERM .............................................................................................................. 886
STV_TBL_TRANS ............................................................................................................. 888
STV_WLM_QMR_CONFIG ................................................................................................. 889
STV_WLM_CLASSIFICATION_CONFIG ................................................................................. 890
STV_WLM_QUERY_QUEUE_STATE ..................................................................................... 891
STV_WLM_QUERY_STATE ................................................................................................ 892
STV_WLM_QUERY_TASK_STATE ........................................................................................ 893
STV_WLM_SERVICE_CLASS_CONFIG .................................................................................. 894
STV_WLM_SERVICE_CLASS_STATE .................................................................................... 896
System Views ......................................................................................................................... 896
API Version 2012-12-01
xi

Amazon Redshift Database Developer Guide
SVV_COLUMNS .............................................................................................................. 897
SVL_COMPILE ................................................................................................................. 899
SVV_DISKUSAGE ............................................................................................................. 900
SVV_EXTERNAL_COLUMNS .............................................................................................. 902
SVV_EXTERNAL_DATABASES ............................................................................................ 902
SVV_EXTERNAL_PARTITIONS ............................................................................................ 903
SVV_EXTERNAL_SCHEMAS ............................................................................................... 903
SVV_EXTERNAL_TABLES .................................................................................................. 904
SVV_INTERLEAVED_COLUMNS .......................................................................................... 905
SVL_QERROR ................................................................................................................. 906
SVL_QLOG ..................................................................................................................... 906
SVV_QUERY_INFLIGHT .................................................................................................... 907
SVL_QUERY_QUEUE_INFO ............................................................................................... 908
SVL_QUERY_METRICS ..................................................................................................... 909
SVL_QUERY_METRICS_SUMMARY ..................................................................................... 911
SVL_QUERY_REPORT ...................................................................................................... 912
SVV_QUERY_STATE ......................................................................................................... 914
SVL_QUERY_SUMMARY ................................................................................................... 916
SVL_S3LOG .................................................................................................................... 918
SVL_S3PARTITION .......................................................................................................... 919
SVL_S3QUERY ................................................................................................................ 920
SVL_S3QUERY_SUMMARY ................................................................................................ 921
SVL_S3RETRIES .............................................................................................................. 924
SVL_STATEMENTTEXT ..................................................................................................... 925
SVV_TABLES .................................................................................................................. 926
SVV_TABLE_INFO ............................................................................................................ 926
SVV_TRANSACTIONS ....................................................................................................... 928
SVL_USER_INFO ............................................................................................................. 929
SVL_UDF_LOG ................................................................................................................ 930
SVV_VACUUM_PROGRESS ................................................................................................ 932
SVV_VACUUM_SUMMARY ................................................................................................ 933
SVL_VACUUM_PERCENTAGE ............................................................................................. 934
System Catalog Tables ............................................................................................................ 935
PG_CLASS_INFO ............................................................................................................. 935
PG_DEFAULT_ACL ........................................................................................................... 936
PG_EXTERNAL_SCHEMA .................................................................................................. 938
PG_LIBRARY ................................................................................................................... 939
PG_STATISTIC_INDICATOR ............................................................................................... 939
PG_TABLE_DEF ............................................................................................................... 940
Querying the Catalog Tables ............................................................................................ 942
Configuration Reference .................................................................................................................. 947
Modifying the Server Configuration .......................................................................................... 947
analyze_threshold_percent ....................................................................................................... 948
Values (Default in Bold) ................................................................................................... 948
Description .................................................................................................................... 948
Examples ....................................................................................................................... 948
datestyle ............................................................................................................................... 948
Values (Default in Bold) ................................................................................................... 948
Description .................................................................................................................... 948
Example ........................................................................................................................ 948
describe_field_name_in_uppercase ............................................................................................ 949
Values (Default in Bold) ................................................................................................... 949
Description .................................................................................................................... 948
Example ........................................................................................................................ 948
enable_result_cache_for_session ............................................................................................... 949
Values (Default in Bold) ................................................................................................... 949
Description .................................................................................................................... 948
API Version 2012-12-01
xii