sysbench压测openGauss

sysbench

sysbench oltp_common --db-driver=pgsql --time=60 --threads=25 --report-interval=1 --pgsql-host=172.30x.x --pgsql-port=44085 --pgsql-user=bpx --pgsql-password=xxxx --pgsql-db=bpx --tables=250 --table-size=10000 prepare

SET search_path TO my_schema;

在openGauss数据库中,可以使用以下命令切换schema:

SET search_path TO schema_name;

其中,schema_name是要切换到的目标schema的名称。这个命令将当前会话的搜索路径设置为指定的schema,使得在没有指定schema名称的情况下执行查询时,会自动在该schema下查找相应的表和对象。

例如,要切换到名为"my_schema"的schema,可以执行以下命令:

SET search_path TO my_schema;

之后,在执行查询或操作时,如果没有显式指定schema名称,系统将默认在"my_schema"下进行查找和操作。
在这里插入图片描述

\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index

在这里插入图片描述

表、序列

bpx=# \d+ sbtest1
                                                  Table "bpx.sbtest1"
 Column |      Type      |                      Modifiers                       | Storage  | Stats target | Description 
--------+----------------+------------------------------------------------------+----------+--------------+-------------
 id     | integer        | not null default nextval('sbtest1_id_seq'::regclass) | plain    |              | 
 k      | integer        | not null default 0                                   | plain    |              | 
 c      | character(120) | not null default ''::bpchar                          | extended |              | 
 pad    | character(60)  | not null default ''::bpchar                          | extended |              | 
Indexes:
    "sbtest1_pkey" PRIMARY KEY, btree (id) TABLESPACE pg_default
    "k_1" btree (k) TABLESPACE pg_default
Has OIDs: no
Options: orientation=row, compression=no

bpx=# \d+ sbtest100_id_seq
             Sequence "bpx.sbtest100_id_seq"
    Column     |  Type   |        Value        | Storage 
---------------+---------+---------------------+---------
 sequence_name | name    | sbtest100_id_seq    | plain
 last_value    | bigint  | 10000               | plain
 start_value   | bigint  | 1                   | plain
 increment_by  | bigint  | 1                   | plain
 max_value     | bigint  | 9223372036854775807 | plain
 min_value     | bigint  | 1                   | plain
 cache_value   | bigint  | 1                   | plain
 log_cnt       | bigint  | 32                  | plain
 is_cycled     | boolean | f                   | plain
 is_called     | boolean | t                   | plain
 uuid          | bigint  | 0                   | plain
Owned by: bpx.sbtest100.id

nextval('sbtest1_id_seq'::regclass) 是一个 PostgreSQL 数据库中的函数。它用于获取指定序列(sequence)的下一个值。

在这个例子中,'sbtest1_id_seq'::regclass 是将字符串 'sbtest1_id_seq' 转换为 regclass 类型。regclass 是 PostgreSQL 中的特殊类型,用于表示表或序列的名称。

函数 nextval() 返回指定序列的下一个值。它从序列中获取一个新的值,并且将该序列的计数器加一。

因此,nextval('sbtest1_id_seq'::regclass) 的作用是返回名为 'sbtest1_id_seq' 的序列的下一个值。

bpx=# select nextval('sbtest1_id_seq'::regclass);
 nextval 
---------
   10001
(1 row)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值