paraccel

Efficient GROUP BY a CASE expression in Amazon Redshift/PostgreSQL

一笑奈何 提交于 2020-01-01 13:27:55
问题 In analytics processing there is often a need to collapse "unimportant" groups of data into a single row in the resulting table. One way to do this is to GROUP BY a CASE expression where unimportant groups are coalesced into a single row via the CASE expression returning a single value, e.g., NULL for the groups. This question is about efficient ways to perform this grouping in Amazon Redshift, which is based on ParAccel: close to PosgreSQL 8.0 in terms of functionality. As an example,

Pivot a table with Amazon RedShift

♀尐吖头ヾ 提交于 2019-12-01 01:03:33
I have several tables in Amazon RedShift that follow the pattern of several dimension columns and a pair of metric name/value columns. DimensionA DimensionB MetricName MetricValue ---------- ---------- ---------- ----------- dimA1 dimB1 m1 v11 dimA1 dimB2 m1 v12 dimA1 dimB2 m2 v21 dimA2 dimB2 m1 v13 dimA3 dimB1 m2 v22 I am looking for a good way to unwind/pivot the data into a form of one row per each unique dimension set, e.g.: DimensionA DimensionB m1 m2 ---------- ---------- --- --- dimA1 dimB1 v11 dimA1 dimB2 v12 v21 dimA2 dimB2 v13 dimA3 dimB1 v22 What is a good pattern for generating

Pivot a table with Amazon RedShift

强颜欢笑 提交于 2019-11-30 19:11:24
问题 I have several tables in Amazon RedShift that follow the pattern of several dimension columns and a pair of metric name/value columns. DimensionA DimensionB MetricName MetricValue ---------- ---------- ---------- ----------- dimA1 dimB1 m1 v11 dimA1 dimB2 m1 v12 dimA1 dimB2 m2 v21 dimA2 dimB2 m1 v13 dimA3 dimB1 m2 v22 I am looking for a good way to unwind/pivot the data into a form of one row per each unique dimension set, e.g.: DimensionA DimensionB m1 m2 ---------- ---------- --- --- dimA1

S3 -> Redshift cannot handle UTF8

烈酒焚心 提交于 2019-11-28 12:08:25
We have a file in S3 that is loaded in to Redshift via the COPY command. The import is failing because a VARCHAR(20) value contains an Ä which is being translated into .. during the copy command and is now too long for the 20 characters. I have verifies that the data is correct in S3, but COPY does not understand the UTF-8 characters during import. Has anyone found a solution for this? tl;dr the byte length for your varchar column just needs to be larger. Detail Multi-byte characters (UTF-8) are supported in the varchar data type, however the length that is provided is in bytes , NOT

S3 -> Redshift cannot handle UTF8

↘锁芯ラ 提交于 2019-11-27 06:47:19
问题 We have a file in S3 that is loaded in to Redshift via the COPY command. The import is failing because a VARCHAR(20) value contains an Ä which is being translated into .. during the copy command and is now too long for the 20 characters. I have verifies that the data is correct in S3, but COPY does not understand the UTF-8 characters during import. Has anyone found a solution for this? 回答1: tl;dr the byte length for your varchar column just needs to be larger. Detail Multi-byte characters