11.4.5 Exporting data in units of chunks
You can output data from a multi-chunk table to a file in units of chunks by using either of the following two methods. Both methods require you to specify the chunk ID of each chunk to be output.
-
Execute the adbexport command by specifying a chunk ID for the -c option
To output data from a multi-chunk table to a file in units of chunks, execute the adbexport command by specifying a chunk ID for the -c option. Note that the adbexport command can be executed by the HADB server, but not by an HADB client.
For details about the adbexport command, see adbexport (Export Data) in the manual HADB Command Reference.
-
Execute the #GETDATA subcommand of the adbsql command
To output data from a multi-chunk table to a file in units of chunks, execute the #GETDATA subcommand of the adbsql command. When you execute #GETDATA by specifying the chunk ID of the output target chunk, you can output the execution result to a file by using redirection. Note that the adbsql command can be executed by the HADB server and by an HADB client (Linux version).
For details about the adbsql command, see adbsql (Execute SQL Statements) in the manual HADB Command Reference.
- Note
-
We recommend that, of the two preceding methods, you use the method that uses the adbexport command. The adbexport command can output data in a shorter time than the adbsql command. Use the adbsql command only when an HADB client (Linux version) needs to output data from a multi-chunk table to a file.
The following shows the types of chunks from which you can output data by using the preceding two methods.
- Types of chunk data that can be output
-
-
Chunk in normal status
-
Chunk in wait status
With the preceding two methods, you can output data from not only chunks in normal status, but also chunks in wait status. Note that you cannot output data from chunks in wait status in the case shown in 11.1.8 Outputting data from a base table to a file (data export).
-
The following describes the procedures for outputting data in units of chunks by using the adbexport command and by using the adbsql command.
- Important
-
If a chunk is being merged with other chunks by using the adbmergechunk command, we recommend that you do not output data from that chunk. Output data from the chunk to a file after the adbmergechunk command has completed the chunk merge processing. If you output data from a chunk that is being merged with other chunks by using the adbmergechunk command, the data to be output to the file differs depending on the timing. For details, see (4) Chunks that are retrieved during execution of the adbmergechunk command in 11.4.9 Merging chunks (to reduce the number of chunks).
■ Procedure for outputting data by executing the adbexport command with the -c option
-
Determine the chunk ID of the chunk to be output.
Check the ID of the chunk you intend to specify in the -c option of the adbexport command. The chunk ID information is stored in the STATUS_CHUNKS system table.
For details about how to determine the chunk ID, see C.9 Searching system tables.
-
Execute the adbexport command.
Based on the determined chunk ID, execute the adbexport command with the -c option specified to output the data that is stored in the chunk you want to output.
To output data to a CSV file compressed in GZIP format, also specify the --compress GZIP option.
For details about the adbexport command, see adbexport (Export Data) in the manual HADB Command Reference.
■ Procedure for outputting data by executing the #GETDATA subcommand of the adbsql command
-
Determine the chunk ID of the chunk to be output.
Check the chunk ID to be specified for CHUNKID in the #GETDATA subcommand of the adbsql command. The chunk ID information is stored in the STATUS_CHUNKS system table.
For details about how to determine the chunk ID, see C.9 Searching system tables.
-
Executing the adbsql command
Based on the determined chunk ID, execute the #GETDATA subcommand of the adbsql command to output the data that is stored in the chunk you want to output.
For details about the #GETDATA subcommand of the adbsql command, see adbsql subcommands in adbsql (Execute SQL Statements) in the manual HADB Command Reference.