You can turn on/off PG-Strom functionality using pg_strom.enabled configuration parameter. pg_strom.enabledパラメータを使用してPG-Strom機能の有効/無効を切替える事ができます。
# SET pg_strom.enabled = off;
The above is the command to turn off the PG-Strom, and, the below is the command to turn on PG-Strom again. 上記がPG-Stromを無効化するコマンド、そして、下記がPG-Stromを再び有効化するコマンドです。
# SET pg_strom.enabled = on;
You can turn off PG-Strom on troubles, then confirm whether the problem is reproducible with no PG-Strom support. トラブル時にはこれらのコマンドを用いてPG-Stromを無効化し、その状態でも問題が再現可能かどうかを確認する事ができます。
The command below allows to turn on/off PG-Strom from out of the session. It is convenient to have performance benchmark according to existence of PG-Strom, if application construct and send queries to PostgreSQL directly. 以下のコマンドを用いることで、セッションの外部からPG-Stromの有効・無効を切り替えることができます。これは、アプリケーションが直接PostgreSQLにクエリを発行するような状況で、PG-Stromの有無に伴う性能差をベンチマークするケースなどで有用です。
# ALTER SYSTEM SET pg_strom.enabled TO off; # SELECT pg_reload_conf();
EXPLAIN command displays the query execution plan. Once PG-Strom gets a role to execute a part of the given query workloads, it shall be shown as CustomScan node; implemented by PG-Strom. EXPLAINコマンドを用いてクエリ実行計画を表示することができます。PG-Stromがクエリ処理の一部を実行することになると、その部分はPG-Stromによって実装されたCustomScanノードとして表示されます。
postgres=# EXPLAIN SELECT cat, avg(ax) FROM t0 NATURAL JOIN t1 NATURAL JOIN t2 GROUP BY cat; QUERY PLAN ----------------------------------------------------------------------------------- HashAggregate (cost=2347813.66..2347813.98 rows=26 width=12) Group Key: t0.cat -> Custom Scan (GpuPreAgg) (cost=14189.15..1878462.46 rows=234 width=44) Bulkload: On (density: 99.33%) Reduction: Local + Global -> Custom Scan (GpuJoin) (cost=10189.15..1851180.43 rows=99326645 width=12) Bulkload: On (density: 100.00%) Depth 1: GpuHashJoin, HashKeys: (bid), JoinQual: (bid = bid) Nrows (in/out: 99.33%), KDS-Hash (size: 12.04MB, nbatches: 1) Depth 2: GpuHashJoin, HashKeys: (aid), JoinQual: (aid = aid) Nrows (in/out: 100.00%), KDS-Hash (size: 12.04MB, nbatches: 1) -> Custom Scan (BulkScan) on t0 (cost=0.00..1833334.80 rows=100000080 width=12) -> Seq Scan on t2 (cost=0.00..1935.00 rows=100000 width=4) -> Seq Scan on t1 (cost=0.00..1935.00 rows=100000 width=12) (14 rows)
In the above example, we can see GpuJoin and GpuPreAgg to process relation's join and partial aggregation, by PG-Strom. On the other hands, once we turned off PG-Strom, then same query generate different query execution plan. 上記の例では、PG-Stromの提供するGpuJoinとGpuPreAggがそれぞれジョインと部分集約演算を実行します。 一方、いったんPG-Stromを無効化すると、同一のクエリが異なった実行計画を生成します。
postgres=# SET pg_strom.enabled = off; SET postgres=# EXPLAIN SELECT cat, avg(ax) FROM t0 NATURAL JOIN t1 NATURAL JOIN t2 GROUP BY cat; QUERY PLAN ----------------------------------------------------------------------------------- HashAggregate (cost=6824660.14..6824660.47 rows=26 width=12) Group Key: t0.cat -> Hash Join (cost=7250.00..6328026.92 rows=99326645 width=12) Hash Cond: (t0.aid = t1.aid) -> Hash Join (cost=3576.00..4182132.55 rows=99326645 width=8) Hash Cond: (t0.bid = t2.bid) -> Seq Scan on t0 (cost=0.00..1833334.80 rows=100000080 width=12) -> Hash (cost=1935.00..1935.00 rows=100000 width=4) -> Seq Scan on t2 (cost=0.00..1935.00 rows=100000 width=4) -> Hash (cost=1935.00..1935.00 rows=100000 width=12) -> Seq Scan on t1 (cost=0.00..1935.00 rows=100000 width=12) (11 rows)
Here is no CustomScan node, thus PG-Strom is not responsible to execution of the query. CustomScanが出現していません、したがって、PG-Stromはこのクエリの実行に関与しません。
PG-Stromの運用においてトラブルが発生した場合、まず、それがPG-Stromに起因するものであるのかどうかを切り分けます。 %%%PGSTROM_MANUAL_XLINK:tutrial-pgstrom_enabled%%%を参照し、PG-Stromを無効化した状態でトラブルを引き起こしたクエリを実行し、問題が再現するかどうかを確認してください。
SET pg_strom.enabled = off;
By the performance monitor of PG-Strom, you can gather more detailed run-time information regarding to the query execution performance.
Set On
to the pg_strom.perfmon
parameter, and then run the target query using EXPLAIN ANALYZE
command.
PG-Stromのパフォーマンスモニタを用いる事で、クエリ実行性能に関するより詳細な情報を採取する事ができます。
パフォーマンスモニタを使用するにはpg_strom.perfmon
パラメータにOn
を設定し、EXPLAIN ANALYZE
コマンドを用いて対象となるクエリを実行します。
If performance monitor is enabled, EXPLAIN ANALYZE
shows number of GPU kernel invocation and time consumption, amount of data transfer over the PCI-E bus using DMA, its performance and etc, in addition to the usual items.
パフォーマンスモニタが有効である状態でクエリを実行すると、EXPLAIN ANALYZE
による通常の表示内容に加えて、GPUで実行された各関数の処理時間や呼び出し回数、PCI-Eバスを介してDMA転送されたデータサイズや転送性能などが表示されます。
postgres=# SET pg_strom.perfmon = on; SET postgres=# EXPLAIN ANALYZE SELECT cat,count(*),avg(ax) FROM t0 NATURAL JOIN t1 NATURAL JOIN t2 GROUP BY cat; QUERY PLAN ----------------------------------------------------------------------------------------------------------------- HashAggregate (cost=3573290.38..3573290.71 rows=26 width=12) (actual time=14310.290..14310.297 rows=26 loops=1) Group Key: t0.cat -> Custom Scan (GpuPreAgg) (cost=16325.67..2871839.94 rows=234 width=48) (actual time=4992.761..14309.959 rows=936 loops=1) Reduction: Local + Global GPU Projection: cat, ax Number of tasks: 468 gpupreagg_main(): total: 980.31ms, avg: 2.09ms, count: 468 - gpupreagg_preparation(): total: 277.16ms, avg: 0.59ms, count: 468 - gpupreagg_local_reduction(): total: 485.22ms, avg: 1.04ms, count: 468 - gpupreagg_global_reduction(): total: 121.51ms, avg: 0.26ms, count: 468 - gpupreagg_final_reduction(): total: 65.05ms, avg: 0.14ms, count: 468 - gpupreagg_fixup_varlena(): total: 0.09ms, avg: 0.02ms, count: 4 Time of load: 13.66sec Time of materialize: 0.09ms DMA send: 10.95GB/sec, len: 7254.57MB, time: 647.23ms, count: 1404 DMA recv: 997.03MB/sec, len: 31.04MB, time: 31.13ms, count: 472 -> Custom Scan (GpuJoin) on t0 (cost=12325.67..2837165.74 rows=98149953 width=12) (actual time=131.377..13659.267 rows=100000000 loops=1) GPU Projection: t0.cat, t1.ax Outer Scan: t0 (actual time=9.097..4571.012 rows=100000000 loops=1) Depth 1: GpuHashJoin, HashKeys: (t0.bid) JoinQuals: (t0.bid = t2.bid) Nrows (in:100000000 out:100000000, 100.00% planned 98.15%) KDS-Hash (size: 9.16MB planned 13.47MB, nbatches: 1 planned 1) Depth 2: GpuHashJoin, HashKeys: (t0.aid) JoinQuals: (t0.aid = t1.aid) Nrows (in:100000000 out:100000000, 100.00% planned 100.00%) KDS-Hash (size: 9.16MB planned 13.47MB, nbatches: 1 planned 1) Inner Buffer: (13.47MB)x(13.47MB), DMA nums: 167, size: 4499.40MB Number of tasks: 499 gpujoin_main(): total: 2512.94ms, avg: 5.04ms, count: 499 - gpujoin_exec_outerscan: total: 58.02ms, avg: 0.12ms, count: 499 - gpujoin_exec_hashjoin: total: 1796.94ms, avg: 1.80ms, count: 998 - gpujoin_projection: total: 634.04ms, avg: 1.27ms, count: 499 Time of inner load: 76.87ms Time of outer load: 9.14sec Time of materialize: 3991.05ms DMA send: 10.86GB/sec, len: 7734.65MB, time: 695.38ms, count: 1497 DMA recv: 11.80GB/sec, len: 7145.93MB, time: 591.62ms, count: 998 -> Seq Scan on t2 (cost=0.00..1935.00 rows=100000 width=4) (actual time=0.013..14.324 rows=100000 loops=1) -> Seq Scan on t1 (cost=0.00..1935.00 rows=100000 width=12) (actual time=0.006..14.078 rows=100000 loops=1) Planning time: 0.887 ms Execution time: 14743.778 ms (42 rows)
Coming Soon... あとで書く
PG-Strom supports the data types below. PG-Stromは以下のデータ型に対応しています。
SQL Data Type SQL データ型 | Internal Form 内部データ表現 | Length データ長 | Remarks 備考 |
---|---|---|---|
boolean |
cl_bool |
1 byte | |
smallint |
cl_short |
2 bytes | |
integer |
cl_int |
4 bytes | |
bigint |
cl_long |
8 bytes | |
real |
cl_float |
4 bytes | |
float |
cl_double |
8 bytes | |
numeric |
cl_ulong |
8 bytes | It maps variable length numeric data on 64bit fixed length datum. Up to 18 digits are available, but may take CPU fallback if overflow. 可変長のnumericデータを64bit固定長データに割り当てて使用。最大18桁まで表現可能だが、桁あふれを起こすとCPU側でフォールバック処理を行う。 |
money |
cl_long |
8 bytes | |
date |
DateADT |
4 bytes | |
time |
TimeADT |
8 bytes | |
time with timezone |
TimeTzADT |
12 bytes | |
timestamp |
Timestamp |
8 bytes | |
timestamp with timezone |
TimestampTz |
8 bytes | |
interval |
Interval |
16 bytes | |
char(n) |
varlena * |
variable length 可変長 | GPU cannot process compressed or TOAST'ed data. 圧縮、またはTOAST済みデータをGPUで扱う事はできません。 |
varchar(n) |
varlena * |
variable length 可変長 | GPU cannot process compressed or TOAST'ed data. 圧縮、またはTOAST済みデータをGPUで扱う事はできません。 |
text |
varlena * |
variable length 可変長 | GPU cannot process compressed or TOAST'ed data. 圧縮、またはTOAST済みデータをGPUで扱う事はできません。 |
bytea |
varlena * |
variable length 可変長 | GPU cannot process compressed or TOAST'ed data. 圧縮、またはTOAST済みデータをGPUで扱う事はできません。 |
GPU cannot evaluate an expression that includes reference to variable length datum, if this datum is compressed or stored in external TOAST table. As a second best, PG-Strom evaluates same expression by CPU, however, it leads performance degradation because it consumes CPU cycles in addition to GPU cycles. GPUが可変長データの参照を含む式の評価を行うとき、当該データが圧縮済み、またはTOASTテーブルに外部格納されているとこれを実行できません。 次善策として、PG-StromはCPUで同じ式を評価しますが、いったんGPUでの処理を行った上にCPUで再評価を行うために性能劣化の原因となります。
ALTER TABLE ... SET STORAGE
command configures the storage mode of columns. It allows avoiding the problem, if you can know which column is referenced by GPU preliminary.
The storage mode PLAIN prohibits compression or external TOAST save, so it allows to reference the variable length field always, however, it may lead an error when you try to save a large record bigger than the page size (it is usually 8KB).
The storage mode MAIN does not prohibit compression or external TOAST save entirely, however, it tries to compress or write out the variable length data only when it has no other way to store the record.
GPUが参照する可変長データ列が予め分かっているのであれば、ALTER TABLE ... SET STORAGE
によって列の保管モードを指定する事で問題を回避する事ができます。
保管モードPLAINを指定した場合、圧縮およびTOASTテーブルへの外部格納は行いませんので、必ずGPUで処理する事ができます。しかし、レコード長が(通常8KBである)ページサイズを越えるような長いデータを格納しようとした時にエラーとなる可能性があります。
保管モードMAINを指定した場合、圧縮およびTOASTテーブルへの外部格納を行う可能性は依然としてありますが、他にレコードを格納する手段が無い時の最終手段としてのみ、圧縮およびTOASTテーブルへの外部格納を行います。
Thus, it is preferable to specify PLAIN if you can ensure the maximum length of the variable like varchar(n)
data type, or MAIN if you cannot deny a string larger than several thousand bytes entirely.
Even if CPU runs the fallback evaluation, it may be minor if a record per million rows.
したがって、varchar(n)
型など文字列長の上限を保証できる場合はPLAINを、必ずしも数KBの文字列が入力される可能性が排除できない場合はMAINを指定するのがよいでしょう。仮に一部のデータに対してCPUでの再実行が発生したとしても、例えば、100万行に1行の割合であればその影響は軽微と考える事もできます。
# ALTER TABLE my_table ALTER varlena_column SET STORAGE main;
Operator 演算子 | Return Value 戻り値 | Remarks 備考 |
---|---|---|
smallint + smallint |
smallint |
|
smallint + integer |
integer |
|
smallint + bigint |
bigint |
|
integer + smallint |
integer |
|
integer + integer |
integer |
|
integer + bigint |
bigint |
|
bigint + smallint |
bigint |
|
bigint + integer |
bigint |
|
bigint + bigint |
bigint |
|
real + real |
real |
|
real + float |
float |
|
float + real |
float |
|
float + float |
float |
|
numeric + numeric |
numeric |
|
smallint - smallint |
smallint |
|
smallint - integer |
integer |
|
smallint - bigint |
bigint |
|
integer - smallint |
integer |
|
integer - integer |
integer |
|
integer - bigint |
bigint |
|
bigint - smallint |
bigint |
|
bigint - integer |
bigint |
|
bigint - bigint |
bigint |
|
real - real |
real |
|
real - float |
float |
|
float - real |
float |
|
float - float |
float |
|
numeric - numeric |
numeric |
|
smallint * smallint |
smallint |
|
smallint * integer |
integer |
|
smallint * bigint |
bigint |
|
integer * smallint |
integer |
|
integer * integer |
integer |
|
integer * bigint |
bigint |
|
bigint * smallint |
bigint |
|
bigint * integer |
bigint |
|
bigint * bigint |
bigint |
|
real * real |
real |
|
real * float |
float |
|
float * real |
float |
|
float * float |
float |
|
numeric * numeric |
numeric |
|
smallint / smallint |
smallint |
|
smallint / integer |
integer |
|
smallint / bigint |
bigint |
|
integer / smallint |
integer |
|
integer / integer |
integer |
|
integer / bigint |
bigint |
|
bigint / smallint |
bigint |
|
bigint / integer |
bigint |
|
bigint / bigint |
bigint |
|
real / real |
real |
|
real / float |
float |
|
float / real |
float |
|
float / float |
float |
|
smallint % smallint |
smallint |
|
integer % integer |
integer |
|
bigint % bigint |
bigint |
|
smallint & smallint |
smallint |
bitwise and |
integer & integer |
integer |
bitwise and |
bigint & bigint |
bigint |
bitwise and |
smallint | smallint |
smallint |
bitwise or |
integer | integer |
integer |
bitwise or |
bigint | bigint |
bigint |
bitwise or |
smallint # smallint |
smallint |
bitwise xor |
integer # integer |
integer |
bitwise xor |
bigint # bigint |
bigint |
bitwise xor |
~smallint |
smallint |
bitwise not |
~integer |
integer |
bitwise not |
~bigint |
bigint |
bitwise not |
smallint >> integer |
smallint |
right shift |
integer >> integer |
integer |
right shift |
bigint >> integer |
bigint |
right shift |
smallint << integer |
smallint |
left shift |
integer << integer |
integer |
left shift |
bigint << integer |
bigint |
left shift |
+smallint |
smallint |
|
+integer |
integer |
|
+bigint |
bigint |
|
+real |
real |
|
+float |
float |
|
+numeric |
numeric |
|
-smallint |
smallint |
|
-integer |
integer |
|
-bigint |
bigint |
|
-real |
real |
|
-float |
float |
|
-numeric |
numeric |
|
@smallint |
smallint |
|
@integer |
integer |
|
@bigint |
bigint |
|
@real |
real |
|
@float |
float |
|
@numeric |
numeric |
Operator 演算子 | Return Value 戻り値 | Remarks 備考 |
---|---|---|
smallint comp smallint |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
integer comp integer |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
bigint comp bigint |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
real comp real |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
float comp float |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
numeric comp numeric |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
Function 関数 | Return Value 戻り値 | Remarks 備考 |
---|---|---|
abs(smallint) |
smallint |
absolute value 絶対値 |
abs(integer) |
integer |
absolute value 絶対値 |
abs(bigint) |
bigint |
absolute value 絶対値 |
abs(real) |
real |
absolute value 絶対値 |
abs(float) |
float |
absolute value 絶対値 |
cbrt(float) |
float |
立方根 |
dcbrt(float) |
float |
立方根 |
ceil(float) |
float |
引数より小さくない最小の整数 |
ceiling(float) |
float |
引数より小さくない最小の整数 |
exp(float) |
float |
指数 |
dexp(float) |
float |
指数 |
floor(float) |
float |
引数より大きくない最大の整数 |
ln(float) |
float |
自然対数 |
dlog1(float) |
float |
自然対数 |
log(float) |
float |
10を底とした対数(常用対数) |
dlog10(float) |
float |
10を底とした対数(常用対数) |
pi() |
float |
円周率 |
power(a float, b float) |
float |
aのb乗 |
pow(a float, b float) |
float |
aのb乗 |
dpow(a float, b float) |
float |
aのb乗 |
round(float) |
float |
四捨五入 |
dround(float) |
float |
四捨五入 |
sign(float) |
float |
引数の符号(-1, 0, +1) |
sqrt(float) |
float |
平方根 |
dsqrt(float) |
float |
平方根 |
trunc(float) |
float |
truncate 切り捨て |
dtrunc(float) |
float |
truncate 切り捨て |
degrees(float) |
float |
ラジアンに対応する度 |
radians(float) |
float |
度に対応するラジアン |
asin(float) |
float |
逆正弦関数 |
atan(float) |
float |
逆正接関数 |
atan2(x float, y float) |
float |
x/yの逆正接関数 |
cos(float) |
float |
余弦関数 |
cot(float) |
float |
余接関数 |
sin(float) |
float |
正弦関数 |
tan(float) |
float |
正接関数 |
Operator 演算子 | Return Value 戻り値 | Remarks 備考 |
---|---|---|
date + integer |
date |
|
integer + date |
date |
|
date - integer |
date |
|
date - date |
integer |
|
date + time |
timestamp |
|
date + time with timezone |
timestamp with timezone |
|
time + date |
timestamp |
|
time - time |
interval |
|
timestamp - timestamp |
interval |
|
time with timezone + interval |
time with timezone |
|
time with timezone - interval |
time with timezone |
|
timestamp with timezone + interval |
timestamp with timezone |
|
timestamp with timezone - interval |
timestamp with timezone |
|
- interval |
interval |
|
interval + interval |
interval |
|
interval - interval |
interval |
|
date comp date |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
date comp timestamp |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
time comp time |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
time with timezone comp time with timezone |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
timestamp comp timestamp |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
timestamp comp date |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
timestamp with timezone comp timestamp with timezone |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
date comp timestamp with timezone |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
timestamp with timezone comp date |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
timestamp comp timestamp with timezone |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
timestamp with timezone comp timestamp |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
interval comp interval |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
overlap(time, time, time, time) |
boolean |
|
overlap(time with timezone, time with timezone, time with timezone, time with timezone) |
boolean |
|
overlap(timestamp, timestamp, timestamp, timestamp) |
boolean |
|
overlap(timestamp with timezone, timestamp with timezone, timestamp with timezone, timestamp with timezone) |
boolean |
|
now() |
timestamp with timezone |
Functions / Operators 関数・演算子 | Return Value 戻り値 | Remarks 備考 |
---|---|---|
char(n) comp char(n) |
boolean |
comp is either of = or <>. compは= または <>。 |
char(n) comp char(n) |
boolean |
comp is either of <, <=, >= or >. Valid only when no-locale or C-locale. compは<, <=, >= または >のいずれか。 ロケールなし、またはCロケールの場合のみ有効。 |
length(char(n)) |
integer |
|
bpcharcmp(char(n), char(n)) |
integer |
|
text comp text |
boolean |
comp is either of = or <>. compは= または <>。 |
text comp text |
boolean |
comp is either of <, <=, >= or >. Valid only when no-locale or C-locale. compは<, <=, >= または >のいずれか。 ロケールなし、またはCロケールの場合のみ有効。 |
length(text) |
integer |
|
bttextcmp(text, text) |
integer |
|
string LIKE pattern |
boolean |
string is text or char(n) type.
pattern is text type.
stringはtext またはchar(n) 型。
patternはtext 型。
|
string NOT LIKE pattern |
boolean |
string is text or char(n) type.
pattern is text type.
stringはtext またはchar(n) 型。
patternはtext 型。
|
string ILIKE pattern |
boolean |
string is text or char(n) type.
pattern is text type.
stringはtext またはchar(n) 型。
patternはtext 型。
Valid only when no-locale or C-locale.
ロケールなし、またはCロケールの場合のみ有効。
|
string NOT ILIKE pattern |
boolean |
string is text or char(n) type.
pattern is text type.
stringはtext またはchar(n) 型。
patternはtext 型。
Valid only when no-locale or C-locale.
ロケールなし、またはCロケールの場合のみ有効。
|
Functions / Operators 関数・演算子 | Return Value 戻り値 | Remarks 備考 |
---|---|---|
money + money |
money |
|
money - money |
money |
|
money / money |
float |
|
money * smallint |
money |
|
money * integer |
money |
|
money * real |
money |
|
money * float |
money |
|
money / smallint |
money |
|
money / integer |
money |
|
money / real |
money |
|
money / float |
money |
|
smallint * money |
money |
|
integer * money |
money |
|
real * money |
money |
|
float * money |
money |
|
money comp money |
boolean |
comp is either of =, <>, <, <=, >= or >. compは=, <>, <, <=, >= または >のいずれか |
cash_cmp(money, money) |
integer |
Destination Type 変換先データ型 | Source 変換元データ型 | Remarks 備考 |
---|---|---|
integer |
boolean |
|
smallint |
{smallint, integer, bigint, real, float, numeric} |
|
integer |
{smallint, integer, bigint, real, float, numeric} |
|
bigint |
{smallint, integer, bigint, real, float, numeric} |
|
real |
{smallint, integer, bigint, real, float, numeric} |
|
float |
{smallint, integer, bigint, real, float, numeric} |
|
numeric |
{smallint, integer, bigint, real, float, numeric} |
|
money |
{integer, bigint, numeric} |
|
date |
{date, timestamp, timestamp with timezone} |
|
time |
{time, time with timezone, timestamp, timestamp with timezone} |
|
time with timezone |
{time, timestamp with timezone} |
|
timestamp |
{date, timestamp with timezone} |
|
timestamp with timezone |
{date, timestamp} |
Expression 式要素 | Return Value 戻り値 | Remarks 備考 |
---|---|---|
COALESCE(value, value, ...) |
type of the value valueの型 | |
GREATEST(value, value, ...) |
type of the value valueの型 | type of the value must have comparison operator. valueのデータ型に大小比較が定義されていなければならない |
LEAST(value, value, ...) |
type of the value valueの型 | type of the value must have comparison operator. valueのデータ型に大小比較が定義されていなければならない |
anytype IS NULL |
boolean |
anytype is one of the supported data type anytypeはサポートされているデータ型の一つ。 |
anytype IS NOT NULL |
boolean |
anytype is one of the supported data type anytypeはサポートされているデータ型の一つ。 |
boolean IS TRUE |
boolean |
|
boolean IS NOT TRUE |
boolean |
|
boolean IS FALSE |
boolean |
|
boolean IS NOT FALSE |
boolean |
|
boolean IS UNKNOWN |
boolean |
|
boolean IS NOT UNKNOWN |
boolean |
|
NOT boolean |
boolean |
|
AND boolean |
boolean |
|
OR boolean |
boolean |
|
CASE WHEN cond THEN result |
same with result resultと同じ | |
CASE expr | ||
scalar comp ANY (array) |
boolean |
scalar is a supported data type,
comp is a supported operator that returns boolean ,
and array is an array consists of supported data types and must be constant value or parameter reference.
scalarはサポートされているデータ型、
compはサポートされている演算子でboolean を返すもの、
および、arrayはサポートされているデータ型から成る配列で、定数またはパラメータ参照である事。
|
scalar comp ALL (array) |
boolean |
scalar is a supported data type,
comp is a supported operator that returns boolean ,
and array is an array consists of supported data types and must be constant value or parameter reference.
scalarはサポートされているデータ型、
compはサポートされている演算子でboolean を返すもの、
および、arrayはサポートされているデータ型から成る配列で、定数またはパラメータ参照である事。
|
It turns on / off the feature of PG-Strom GpuScan機能の有効、無効を切替えます。
Default: on デフォルト: on
When direct child of GpuJoin or GpuPreAgg plan node is full table scan, GpuJoin or GpuPreAgg pull up this full table scan and execute by itself, to reduce overhead of function call or data copy, if this parameter is enabled. クエリ実行計画において、GpuJoinやGpuPreAggの直下でテーブルスキャンの実行が計画されている場合、GpuJoinやGpuPreAgg自身がこのスキャン処理を実行する事で、関数呼び出しおよびデータコピーのオーバーヘッドを削減します。
Default: On デフォルト: On
It specifies the amount of pre-built device program cache. If you plan to use very various kind of SQL queries, consider larger capacity. On the other hands, this cache is allocated on the shared memory, it is not preferable to acquire than necessity. ビルド済みデバイスプログラムを保持するキャッシュの容量を指定します。 非常に多様な種類のSQLを利用する場合には容量の拡大を検討してください。一方、キャッシュは共有メモリ上に確保されるため、必要以上に確保すべきでもありません。
default: 48MB, congurable only when startup デフォルト: 48MB、起動時のみ設定可能
If enabled, it tries to collect crash dump when device program performing on GPU device raised error.
It is internally equivalent to set environment variables CUDA_ENABLE_COREDUMP_ON_EXCEPTION=1
and CUDA_ENABLE_CPU_COREDUMP_ON_EXCEPTION=0
. On the other hands, it has a known issue; not workable on CUDA7.5, so we don't recommend to use.
GPUで動作するデバイスプログラムがエラーを起こした時に、クラッシュダンプの採取を試みます。
内部的には、環境変数CUDA_ENABLE_COREDUMP_ON_EXCEPTION=1
とCUDA_ENABLE_CPU_COREDUMP_ON_EXCEPTION=0
をセットする事と等価です。CUDA 7.5では正しく動作しないという既知問題があるため、使用は推奨されません。
Default: off, configurable only when startup デフォルト: off、起動時のみ設定可能
It specifies the unit size when PG-Strom sends/receives data chunks to/from GPU. PG-StromがGPUとデータを送受信する際のチャンクサイズを指定します。
Default: 15MB デフォルト: 15MB
It specifies the maximum size when PG-Strom sends/receives data chunks to/from GPU.
In case when number of input rows is larger than number of output rows like GpuJoin, we may need larger result buffer towards the input up to pg_strom.chunk_size
.
PG-Strom will not expand the result buffer more than pg_strom.chunk_limit
, then try to iterate GPU kernel invocation.
PG-StromがGPUとデータを送受信する際の最大チャンクサイズを指定します。
GpuJoinのように入力行数よりも出力行数が多い場合、pg_strom.chunk_size
の入力に対してより大きな結果バッファが必要な事があります。
pg_strom.chunk_limit
までであれば、PG-Stromは結果バッファを拡大して対応します。それでも不足する場合、GPU kernelの呼び出しを繰り返す事により対応します。
Default: 5 * pg_strom.chunk_size
デフォルト: 5 * pg_strom.chunk_size
It enables or disables all the feature of PG-Strom. PG-Strom全機能のOn/Offを切替えます。
Default: On デフォルト: On
It enables or disables CPU fallback feature. PG-Strom may give up execution of the GPU code depending on the supplied data; too large, externally toasted, ... for example. If CPU fallback is enabled, PG-Strom run the equivalent stuff by CPU, but sequentially. CPU fallback ensures the query's executability, but it may also lead unexpected performance degradation. It is a trade-off stuff. CPUフォールバック機能のOn/Offを切替えます。 (例えば、巨大すぎる、外部TOAST表に格納されているなど、)入力データ次第でPG-StromはGPUコードの実行を断念する事があります。 CPUフォールバックが有効であれば、PG-Stromは同等の処理をCPU上で実行します。しかし、これへ並列実行ではありません。 CPUフォールバックはクエリを確実に実行可能にしますが、一方で、予測できない性能の低下を招く可能性があり、これはトレードオフです。 NOTE: GPU code may require CPU fallback to raise an appropriate error, like division-by-zero. Please pay attention that disabling CPU fallback may hide actual reason of the error. 注意:例えばゼロ除算など、CPU側に適切なエラーを発生させる事を目的として、GPU側がCPUフォールバックを要求する事があります。CPUフォールバックを無効化する事で、真のエラー原因が出力されなくなる可能性についても留意してください。
Default: On デフォルト: On
It enables or disables the performance monitor of PG-Strom.
If the performance monitor is enabled, EXPLAIN ANALYZE
prints additional performance information.
パフォーマンスモニタの有効、無効を切替えます。
パフォーマンスモニタが有効化されている状態でEXPLAIN ANALYZE
を実行すると、追加的な性能情報が出力されます。
Default: Off デフォルト: Off
Obsoleted, has no effect. 廃止予定。特に効果はありません。
Default: Off デフォルト: Off
It writes out the GPU device program generated by PG-Strom.
If this option is enabled, EXPLAIN VERBOSE
prints a path of temporary file that contains the source code.
PG-Stromが自動生成したGPUデバイスプログラムを一時ファイルに書き出します。
本オプションが有効である状態でEXPLAIN VERBOSEを実行すると、ソースコードを含む一時ファイルのパスが出力されます。
Default: Off デフォルト: Off
It specifies the maximum number of concurrent tasks that shall be executed asynchronously on GPU device. GPUに対して非同期に処理を行うデバイスプログラム実行要求の最大多重度を指定します。
Default: 32 デフォルト: 32
Obsoleted, has no effect 廃止予定。特に効果はありません。
Default: 1.10 デフォルト: 1.10
We cannot predicate exact amount of result buffer in some kind of SQL workloads, like tables join for example; we cannot know exact number of result rows except for anomalistic case. This option indicates to allocate larger result buffer with specified ratio towards the estimated necessity, to reduce frequency of retry or CPU fallback by lack of result buffer. On the other hands, we don't recommend to allocate larger margin than necessity due to over consumption of device memory. GPUで処理するSQLワークロードの中には、実際に処理を行うまで結果バッファに必要な大きさが正確には分からないものがあります。例えば、テーブル同士をJOINする場合、例外的な状況を除き、実際にJOINを行わなければ何行が生成されるのか分かりません。 このオプションは、結果バッファの獲得時に一定の割合のマージンを取る事で、結果バッファの不足に伴う再実行やフォールバック処理の頻度を減らします。 一方で、無駄に大きなマージンを取る事はデバイスメモリの浪費に繋がるためお勧めできません。
Default: 1.25 (25% of margin) デフォルト: 1.25 (25%のマージン)
A cost parameter when planner estimates the plan executed by GPU. It represents the cost for GPU device initialization and build of device program. A larger value of this parameter will prevent applying PG-Strom on smaller tables. プラナーがGPU処理のコストを見積もる時に使用するコストパラメータの一つで、GPUデバイスの初期化やデバイスプログラムのビルドに要するコストを表現します。このパラメータを大きな値にするほど、サイズの小さなテーブルに対してPG-Stromが機能しにくくなります。
Default: 4000 * DEFAULT_SEQ_PAGE_COST
デフォルト: 4000 * DEFAULT_SEQ_PAGE_COST
A cost parameter when planner estimates the plan executed by GPU. It represents the cost for DMA transfer of data chunk with pg_strom.chunk_size
length.
プラナーがGPU処理のコストを見積もる時に使用するコストパラメータの一つで、pg_strom.chunk_size
分の大きさを持つデータチャンクをGPUデバイスにDMA転送するために必要なコストを表現します。
Default: 10 * DEFAULT_SEQ_PAGE_COST
デフォルト: 10 * DEFAULT_SEQ_PAGE_COST
A cost parameter when planner estimates the plan executed by GPU. It represents the cost to evaluate expression node by GPU. A smaller value of this parameter means that computing capability of GPU is better than CPU. プラナーがGPU処理のコストを見積もる時に使用するコストパラメータの一つで、GPUデバイスが計算式を処理する際のコストを表現します。この値を小さくするほど、GPUデバイスの計算能力がCPUより優れているという事を意味します。
Default: DEFAULT_CPU_OPERATOR_COST
/ 32
デフォルト: DEFAULT_CPU_OPERATOR_COST
/ 32
Obsoleted, not used now 廃止予定。現在は使われていません
Default: DEFAULT_CPU_TUPLE_COST
/ 32
デフォルト: DEFAULT_CPU_TUPLE_COST
/ 32
It enables or disables the feature of GpuSort. It is configured to off in the default, because of software quality issue at the current version. GpuSort機能の有効・無効を切替えます。 現バージョンのGpuSortは品質が安定していないため、デフォルトoffに設定されています。
Default: Off デフォルト: Off
A debug option. If enabled, it injects GpuSort
into the query execution plan regardless of the estimated cost.
Don't use this parameter regularly.
デバッグ用オプションです。推定コスト値に関係なくGpuSortをクエリ実行プランに埋め込みます。通常は使用しないでください。
Default: Off デフォルト: Off
Obsoleted, not used now 廃止予定。現在は使われていません。
Default: max_worker_processes / 2 デフォルト: max_worker_processes / 2
It enables and disables GpuNestLoop feature. GpuNestLoop機能の有効・無効を切替えます。
Default: On デフォルト: On
It enables and disables GpuHashJoin feature. GpuHashJoin機能の有効・無効を切替えます。
Default: On デフォルト: On
It enables and disables GpuPreAgg feature. GpuPreAgg機能の有効・無効を切替えます。
Default: On デフォルト: On
A debug option. If enabled, it injects GpuPreAgg
into the query execution plan regardless of the estimated cost.
Don't use this parameter regularly.
デバッグオプションです。推定コスト値に関係なくGpuPreAgg処理をクエリ実行プランに埋め込みます。
通常は使用しないでください。
Default: Off デフォルト: Off