-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Much slower query on meta data compared with CockroachDB and PostgresSQL #15224
Comments
@bnuzhouwei can you do explain analyze of the query on all 3 cases? |
Also, what's the hardware and how many nodes are you using? |
Only one single node, and my computer is:
the compose file for docker to create a test enviroment: version: '2'
volumes:
yb-master-data-1:
yb-tserver-data-1:
services:
yb-master:
image: yugabytedb/yugabyte:latest
container_name: yb-master-n1
volumes:
- yb-master-data-1:/mnt/master
command: [ "/home/yugabyte/bin/yb-master",
"--fs_data_dirs=/mnt/master",
"--master_addresses=yb-master-n1:7100",
"--rpc_bind_addresses=yb-master-n1:7100",
"--replication_factor=1"]
ports:
- "7000:7000"
environment:
SERVICE_7000_NAME: yb-master
yb-tserver:
image: yugabytedb/yugabyte:latest
container_name: yb-tserver-n1
volumes:
- yb-tserver-data-1:/mnt/tserver
command: [ "/home/yugabyte/bin/yb-tserver",
"--fs_data_dirs=/mnt/tserver",
"--enable_ysql",
"--rpc_bind_addresses=yb-tserver-n1:9100",
"--tserver_master_addrs=yb-master-n1:7100"]
ports:
- "9042:9042"
- "5433:5433"
- "9000:9000"
environment:
SERVICE_5433_NAME: ysql
SERVICE_9042_NAME: ycql
SERVICE_6379_NAME: yedis
SERVICE_9000_NAME: yb-tserver
depends_on:
- yb-master I am testing yugabytes, and i want to suit my app to YGDB, my app need to read the meta data of of all table and columns to dynamically create SQL. So i find the poor performance of YGDB to query join meta tables, while CRDB and PostgreSQL are faster. I think may be because of lacking indexes on meta tables of YGDB? |
You have to paste the explain analyze of the queries. The reason is probably because the metadata is located in yb-master. yb-tserver has to do RPCs to it and it's not very efficient. How often are you running metadata queries? |
I don't know how to paste the explain analyze of the queries. The query is fast when query each table, but slow in join tables. -- fast:
select * from pg_attribute
select * from pg_class
-- very slow:
select count(0) FROM pg_attribute t1 JOIN pg_class t2 ON t1.attrelid = t2.oid |
Run the query below and paste the output: explain analyze select count(0) FROM pg_attribute t1 JOIN pg_class t2 ON t1.attrelid = t2.oidl
Please answer |
Hi,
|
@FranckPachot Yes, much fater after set yb_bnl_batch_size, but it only for a query. |
You can add |
I use PostgreSQL 11.2-YB-2.14.5.0-b0 on x86_64-pc-linux-gnu, compiled by clang version 12.0.1 (https://github.com/yugabyte/llvm-project.git bdb147e675d8c87cee72cc1f87c4b82855977d94), 64-bit, the problem still have. And no yb_bnl_batch_size variable can be set.
Almost every query i need the schema tables, because my engine use FillSchema to got a datatable of schema, and then a AdminUI is auto created from the schema table. |
explain analyze select count(0) FROM pg_attribute t1 JOIN pg_class t2 ON t1.attrelid = t2.oid
|
Ok, for versions that do not have Batched Nested Loop yes, I have an ugly one:
but better do that only for queries on the dictionary. Ideally as a hint |
Not a good user experience, how to set the default configs. Use Navicat double click to open a table, also very slow... The metadata do cause many performance issues.. |
The defaults can be set at cluster, database, user, connection, session, transaction, que level. I don't know FillSchema but reading the schema tables for each query is not what an application is supposed to do. This will never be scalable |
Closing this as the issue is identified -- the fundamental issue (changing the defaults) should be tracked in: #14070. |
Jira Link: DB-4403
Description
The following sql:
Took 0.9s on YBDB, but only 0.014s on CRDB and PostgreSQL.
The text was updated successfully, but these errors were encountered: