HDFql Reference Manual v2.6.0

6.8.17SET THREAD

Syntax

SET THREAD {thread_number | MAX | DEFAULT}

Description

Set the number of (CPU) threads56 to use when executing operations that support parallelism. In case the keyword MAX is specified, the number of (CPU) threads to use is set to the maximum number of (CPU) cores available on the machine. In case the keyword DEFAULT is specified, the number of (CPU) threads is set to the maximum number of (CPU) cores available on the machine (i.e. equivalent to specifying the keyword MAX).

Parameter(s)

thread_number – optional integer that specifies the number of (CPU) threads to use when executing operations that support parallelism. If thread_number is specified, it must be equal to or greater than one (otherwise an error is raised).

Return

Nothing

Example(s)

# set number of (CPU) threads (to use when executing operations that support parallelism) to 2
SET THREAD 2

# select (i.e. read) data from dataset "my_dataset" and populate cursor in use with it in ascending order using 2 (CPU) threads
SELECT FROM my_dataset ORDER ASC

# set number of (CPU) threads (to use when executing operations that support parallelism) to 8
SET THREAD 8

# select (i.e. read) data from dataset "my_dataset" and populate cursor in use with it in descending order using 8 (CPU) threads
SELECT FROM my_dataset ORDER DESC 

# set number of (CPU) threads (to use when executing operations that support parallelism) to the maximum number of (CPU) available on the machine
SET THREAD MAX

# select (i.e. read) data from dataset "my_dataset" and populate cursor in use with it in ascending order using a number of (CPU) threads equivalent to the maximum number of (CPU) cores available on the machine
SELECT FROM my_dataset ORDER ASC

Notes

  1. By default (i.e. upon initialization of the HDFql library), the number of (CPU) threads to use is set to the maximum number of (CPU) cores available on the machine. ↩