Grant command become slow when the number of tables increases

sql

(ben) #1

I created 239 tables in a database, and grant all privileges to a user like the below:

grant all on table test.* to iris;
GRANT

Time: 17.214875487s

The grant command takes 17 seconds. I think it is too slow. Does CockroachDB have some configurations to solve the problem? My CockroachDB version is 2.0.


(Ron Arévalo) #2

Hey @ben,

I tried to reproduce this on my end by creating the same number of tables. Here is an example of my create table statement:

create table TEST1(
	id INT,
	first_name VARCHAR(50),
	last_name VARCHAR(50),
	email VARCHAR(50),
	gender VARCHAR(50),
	ip_address VARCHAR(20)
);

I created 239 of these, and then ran the grant all privileges statement:

grant all on table test.* to user1

This was my output:

root@:26257/test> grant all on table test.* to user1;
GRANT

Time: 1.827206434s

Could you try reproducing this? However before you do can you set tracing to on. If you are unsure how to do that, you can take a look at the docs here. That would give us a better idea of what might be happening.

Thanks,

Ron