This topic describes the query command in gfsh, the VMware Tanzu GemFire command-line interface.

Use this command to run queries against Tanzu GemFire regions.

If a limit restricting the result size is not set in the query, then a default limit of the gfsh environment variable APP_FETCH_SIZE is applied. For more information about APP_FETCH_SIZE, see Useful gfsh Shell Variables.

When using the query command, surround the OQL query with single quotation marks. The OQL query must be a SELECT expression that references at least one region.

Note: Do not execute this command from gfsh if the objects being queried contain cyclic references.

Availability: Online. You must be connected in gfsh to a JMX Manager member to use this command.

Syntax:

query --query=value [--file=path/to/results/file] [--member=member-name]

Name Description
‑‑query Required. The OQL string. This must be a SELECT expression that references at least one region.
‑‑file When specified, all query results are written to the specified file. An error is issued if the file already exists.
‑‑member Name or ID of the member on which to execute the query. You can find the name or ID in the output of the gfsh describe region command, for example.

Sample Output:

gfsh>query --query='SELECT * FROM /region2'

Result     : true
startCount : 0
endCount   : 20
Rows       : 1

Result
-----------------
('Hello World!!')

NEXT_STEP_NAME : END
check-circle-line exclamation-circle-line close-line
Scroll to top icon