Data Types

PG-Strom support the following data types for use on GPU device.

Numeric types

SQL data types Length Memo
smallint 2 bytes 16bit integer data type
integer 4 bytes 32bit integer data type
bigint 8 bytes 64bit integer data type
float2 2 bytes Half precision data type. An extra data type by PG-Strom
real 4 bytes Single precision floating-point data type
float 8 bytes Double precision floating-point data type
numeric variable mapped to 128bit fixed-point numerical internal format

Note

When GPU processes values in numeric data type, it is converted to an internal 128bit fixed-point number because of implementation reason. (This layout is identical to Decimal type in Apache Arrow.) It is transparently converted to/from the internal format, on the other hands, PG-Strom cannot convert numaric datum with large number of digits, so tries to fallback operations by CPU. Therefore, it may lead slowdown if numeric data with large number of digits are supplied to GPU device. To avoid the problem, turn off the GUC option pg_strom.enable_numeric_type not to run operational expression including numeric data types on GPU devices.

Note

Even though GPU supports half-precision floating-point numbers by hardware, CPU (x86_64 processor) does not support it yet. So, when CPU processes float2 data types, it transform them to float or double on calculations. So, CPU has no advantages for calculation performance of float2, unlike GPU. It is a feature to save storage/memory capacity for machine-learning / statistical-analytics.

Built-in date and time types

SQL data types Length Memo
date 4 bytes Date data type
time 8 bytes Time data type
timetz 12 bytes Time with timezone data type
timestamp 8 bytes Timestamp data type
timestamptz 8 bytes Timestamp with timezone data type
interval 16 bytes Interval data type

Built-in variable length types

SQL data types Length Memo
bpchar variable variable length text with whitespace paddings
varchar variable variable length text type
text variable variable length text type
bytea variable variable length binary type

Built-in unstructured data types

SQL data types Length Memo
jsonb variable

Note

Pay attention for the two points below, when GPU processes jsonb data types. jsonb is not performance efficient data types because it has to load unreferenced attributes onto GPU from the storage, so tend to consume I/O bandwidth by junk data. In case when jsonb data length exceeds the threshold of datum TOASTen, entire jsonb value is written out to TOAST table, thus, GPU cannot process these values and invokes inefficient CPU-fallback operations. Regarding to the 2nd problem, you can extend table's storage option toast_tuple_target to enlarge the threshold for datum TOASTen.

Built-in miscellaneous types

SQL data types Length Memo
boolean 1 byte Boolean data type
money 8 bytes Money data type
uuid 16 bytes UUID data type
macaddr 6 bytes Network MAC address data type
inet 7 or 19 bytes Network address data type
cidr 7 or 19 bytes Network address data type

Built-in range data types

SQL data types Length Memo
int4range 14 bytes Range type of 32bit integer
int8range 22 bytes Range type of 64bit integer
tsrange 22 bytes Range type of timestamp data
tstzrange 22 bytes Range type of timestamp with timezone data
daterange 14 bytes Range type of date type

PostGIS data types

SQL data types Length Memo
geometry variable Geometry object of PostGIS