How Can I Configure init_td
Transaction directory (TD) is a unique structure used by Ustore tables to store page transaction information. The number of TDs determines the maximum number of concurrent transactions supported on a page. When creating a table or index, you can specify the initial TD size init_td, whose default value is 4. That is, four concurrent transactions are supported to modify the page. The maximum value of init_td is 128.
You can configure init_td based on the service concurrency requirements. Besides, you can also configure it based on the occurrence frequency of wait available td events during service running. Generally, the value of wait available td is 0. If the value of wait available td is not 0, there are events waiting for available TDs. In this case, you are advised to increase the value of init_td. If the value 0 is an occasional situation, you are not advised to adjust init_td because extra TD slots occupy more space. You are advised to gradually increase the value in ascending order, such as 8, 16, 32, 48, ..., and 128, and check whether the number of wait events decreases significantly in this process. Use the minimum value of init_td with few wait events as the default value to save space. wait available td is one of the values of wait_status. wait_status indicates the waiting status of the current thread, including the waiting status details. You can query the value of wait_status in the PG_THREAD_WAIT_STATUS view. The value none indicates that the system is not waiting for any event. If there is a wait event, you can view the value of wait available td. The following is an example. For details about init_td, see "SQL Reference > SQL Syntax > CREATE TABLE" in Developer Guide. To view and modify the value of init_td, perform the following steps:
gaussdb=# CREATE TABLE test1(name varchar) WITH(storage_type = ustore, init_td=2); gaussdb=# \d+ test1 Table "public.test1" Column | Type | Modifiers | Storage | Stats target | Description --------+-------------------+-----------+----------+--------------+------------- name | character varying | | extended | | Has OIDs: no Options: orientation=row, storage_type=ustore, init_td=2, compression=no, segment=off, toast.storage_type=ustore, toast.toast_storage_type=enhanced_toast gaussdb=# ALTER TABLE test1 set(init_td=8); gaussdb=# \d+ test1 Table "public.test1" Column | Type | Modifiers | Storage | Stats target | Description --------+-------------------+-----------+----------+--------------+------------- name | character varying | | extended | | Has OIDs: no Options: orientation=row, storage_type=ustore, compression=no, segment=off, init_td=8, toast.storage_type=ustore, toast.toast_storage_type=enhanced_toast gaussdb=# SELECT * FROM pg_thread_wait_status; node_name | db_name | thread_name | query_id | tid | sessionid | lwtid | psessionid | tlevel | smpid | wait_status | wait_event | locktag | lo ckmode | block_sessionid | global_sessionid -----------+----------+---------------------------------+-----------------+-----------------+-----------------+-------+------------+--------+-------+-------------+------------+---------+--- -------+-----------------+------------------ sgnode | | PageWriter | 0 | 139769678919424 | 139769678919424 | 16915 | | 0 | 0 | none | none | | | | 0:0#0 sgnode | | PageWriter | 0 | 139769736066816 | 139769736066816 | 16913 | | 0 | 0 | none | none | | | | 0:0#0 sgnode | | PageWriter | 0 | 139769707755264 | 139769707755264 | 16914 | | 0 | 0 | none | none | | | | 0:0#0 sgnode | | PageWriter | 0 | 139769761756928 | 139769761756928 | 16912 | | 0 | 0 | none | none | | | | 0:0#0 sgnode | | PageWriter | 0 | 139769783772928 | 139769783772928 | 16911 | | 0 | 0 | none | none | | | | 0:0#0 gaussdb=#DROP TABLE test1; DROP TABLE
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot