由于我们在Amazon Redhshift SQL(基于PostgreSQL 8.0.2)中的局限性。为了其他一些复杂的查询目的,我被迫执行以下查询:
create temporary table NS AS (
select 1 as n union all
select 2 union all
select 3 union all
select 4 union all
select 5 union all
select 6 union all
select 7 union all
select 8 union all
select 9 union all
select 10 union all
select 11 union all
select 12 union all
select 13 union all
select 14 union all
select 15 union all
select 16 union all
select 17 union all
select 18 union all
select 19 union all
select 20 union all
select 21 union all
select 22 union all
select 23 union all
select 24 union all
select 25 union all
select 26 union all
select 27 union all
select 28 union all
select 29 union all
select 30 union all
select 31 union all
select 32 union all
select 33 union all
select 34 union all
select 35 union all
select 36 union all
select 37 union all
select 38 union all
select 39 union all
select 40 union all
select 41 union all
select 42 union all
select 43 union all
select 44 union all
select 45 union all
select 46 union all
select 47 union all
select 48 union all
select 49 union all
select 50 union all
select 51 union all
select 52 union all
select 53 union all
select 54 union all
select 55 union all
select 56 union all
select 57 union all
select 58 union all
select 59 union all
select 60 union all
select 61 union all
select 62 union all
select 63 union all
select 64 union all
select 65 union all
select 66 union all
select 67 union all
select 68 union all
select 69 union all
select 70 union all
select 71 union all
select 72 union all
select 73 union all
select 74 union all
select 75 union all
select 76 union all
select 77 union all
select 78 union all
select 79 union all
select 80 union all
select 81 union all
select 82 union all
select 83 union all
select 84 union all
select 85 union all
select 86 union all
select 87 union all
select 88 union all
select 89 union all
select 90 union all
select 91 union all
select 92 union all
select 93 union all
select 94 union all
select 95 union all
select 96 union all
select 97 union all
select 98 union all
select 99 union all
select 100 union all
select 101 union all
select 102 union all
select 103 union all
select 104 union all
select 105 union all
select 106 union all
select 107 union all
select 108 union all
select 109 union all
select 110 union all
select 111 union all
select 112 union all
select 113 union all
select 114 union all
select 115 union all
select 116 union all
select 117 union all
select 118 union all
select 119 union all
select 120 union all
select 121 union all
select 122 union all
select 123 union all
select 124 union all
select 125 union all
select 126 union all
select 127 union all
select 128 union all
select 129 union all
select 130 union all
select 131 union all
select 132 union all
select 133 union all
select 134 union all
select 135 union all
select 136 union all
select 137 union all
select 138 union all
select 139 union all
select 140 union all
select 141 union all
select 142 union all
select 143 union all
select 144 union all
select 145 union all
select 146 union all
select 147 union all
select 148 union all
select 149 union all
select 150 union all
select 151 union all
select 152 union all
select 153 union all
select 154 union all
select 155 union all
select 156 union all
select 157 union all
select 158 union all
select 159 union all
select 160 union all
select 161 union all
select 162 union all
select 163 union all
select 164 union all
select 165 union all
select 166 union all
select 167 union all
select 168 union all
select 169 union all
select 170 union all
select 171 union all
select 172 union all
select 173 union all
select 174 union all
select 175 union all
select 176 union all
select 177 union all
select 178 union all
select 179 union all
select 180 union all
select 181 union all
select 182 union all
select 183 union all
select 184 union all
select 185 union all
select 186 union all
select 187 union all
select 188 union all
select 189 union all
select 190 union all
select 191 union all
select 192 union all
select 193 union all
select 194 union all
select 195 union all
select 196 union all
select 197 union all
select 198 union all
select 199 union all
select 200
);
但是这只执行了一次,后来甚至什至在我尝试的所有三种介质中都没有抛出任何错误的情况下执行失败。即SQL Workbech,Amazon Hubble和Amazon ETL Manager。因此,此简单查询仅偶尔执行,而大部分时间不执行。您能否让我知道我们可以合并的select语句数量是否有限制?如果是,为什么它甚至都不会引发错误?
谢谢。
答案 0 :(得分:3)
在不使用200个并集的情况下使用generate_series()
的方式如何?
CREATE TEMP TABLE NS AS SELECT * FROM generate_series(1, 200)