Open timgraham opened 1 year ago
Hello, I am Blathers. I am here to help you get the issue triaged.
Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.
I have CC'd a few people who may be able to assist you:
If we have not gotten back to your issue within a few business days, you can try the following:
:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.
Would it be possible to see the entire statements that are slow?
I've added them in the issue description.
Disabling the join hint in the pg_table_is_visible
SQL body caused execution time on my machine to go from ~50ms for each query to 20-30ms. We can remove the join hints for the builtin functions that are expected to be inlined, but I think we should also consider ignoring join hints for functions that are inlined.
Disabling the join hint in the pg_table_is_visible SQL body caused execution time on my machine to go from ~50ms for each query to 20-30ms.
@DrewKimball could you say more about how you tested that? I tried the change in this draft PR https://github.com/cockroachdb/cockroach/pull/109377/, and did not see much difference.
From runnning N=10 BENCHTIMEOUT=24h PKG=./pkg/bench/rttanalysis/ BENCHES=BenchmarkORMQueries/django ./scripts/bench 'HEAD^' 'HEAD'
goos: darwin
goarch: arm64
│ ./previous │ ./new │
│ sec/op │ sec/op vs base │
ORMQueries/django_column_introspection_1_table-10 14.95m ± 2% 14.69m ± 1% -1.78% (p=0.005 n=10)
ORMQueries/django_column_introspection_4_tables-10 14.65m ± 5% 14.71m ± 1% ~ (p=0.631 n=10)
ORMQueries/django_column_introspection_8_tables-10 15.15m ± 2% 15.07m ± 3% ~ (p=0.684 n=10)
ORMQueries/django_table_introspection_1_table-10 20.20m ± 3% 19.67m ± 2% -2.60% (p=0.023 n=10)
ORMQueries/django_table_introspection_8_tables-10 20.49m ± 3% 20.26m ± 2% ~ (p=0.165 n=10)
ORMQueries/django_comment_introspection_with_comments-10 24.19m ± 1% 24.30m ± 2% ~ (p=0.529 n=10)
geomean 17.93m 17.78m -0.85%
│ ./previous │ ./new │
│ roundtrips │ roundtrips vs base │
ORMQueries/django_column_introspection_1_table-10 4.000 ± 0% 4.000 ± 0% ~ (p=1.000 n=10) ¹
ORMQueries/django_column_introspection_4_tables-10 4.000 ± 0% 4.000 ± 0% ~ (p=1.000 n=10) ¹
ORMQueries/django_column_introspection_8_tables-10 4.000 ± 0% 4.000 ± 0% ~ (p=1.000 n=10) ¹
ORMQueries/django_table_introspection_1_table-10 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=10) ¹
ORMQueries/django_table_introspection_8_tables-10 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=10) ¹
ORMQueries/django_comment_introspection_with_comments-10 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=10) ¹
geomean 4.472 4.472 +0.00%
¹ all samples are equal
│ ./previous │ ./new │
│ B/op │ B/op vs base │
ORMQueries/django_column_introspection_1_table-10 10.05Mi ± 1% 10.11Mi ± 1% ~ (p=0.353 n=10)
ORMQueries/django_column_introspection_4_tables-10 9.019Mi ± 1% 9.010Mi ± 2% ~ (p=0.971 n=10)
ORMQueries/django_column_introspection_8_tables-10 7.760Mi ± 3% 7.724Mi ± 1% ~ (p=0.315 n=10)
ORMQueries/django_table_introspection_1_table-10 12.55Mi ± 1% 12.48Mi ± 1% ~ (p=0.089 n=10)
ORMQueries/django_table_introspection_8_tables-10 10.21Mi ± 1% 10.28Mi ± 2% ~ (p=0.280 n=10)
ORMQueries/django_comment_introspection_with_comments-10 14.56Mi ± 1% 14.39Mi ± 1% -1.20% (p=0.023 n=10)
geomean 10.46Mi 10.45Mi -0.17%
│ ./previous │ ./new │
│ allocs/op │ allocs/op vs base │
ORMQueries/django_column_introspection_1_table-10 102.3k ± 1% 102.2k ± 1% ~ (p=0.912 n=10)
ORMQueries/django_column_introspection_4_tables-10 88.80k ± 1% 88.58k ± 2% ~ (p=0.684 n=10)
ORMQueries/django_column_introspection_8_tables-10 73.19k ± 2% 72.48k ± 2% ~ (p=0.247 n=10)
ORMQueries/django_table_introspection_1_table-10 120.6k ± 1% 120.6k ± 1% ~ (p=0.218 n=10)
ORMQueries/django_table_introspection_8_tables-10 92.54k ± 1% 93.32k ± 3% ~ (p=0.393 n=10)
ORMQueries/django_comment_introspection_with_comments-10 128.8k ± 2% 126.5k ± 1% -1.77% (p=0.005 n=10)
geomean 99.24k 98.87k -0.37%
@DrewKimball could you say more about how you tested that? I tried the change in this draft PR https://github.com/cockroachdb/cockroach/pull/109377, and did not see much difference.
I just ran them manually on a local cluster on my machine - I didn't know we already had them in a benchmark. Though, I'm not sure that the benchmark is reproducing the issue, 14.95m
means ms
right? I'm guessing the slowness of these queries depends on the actual content of the tables involved.
I'm guessing the slowness of these queries depends on the actual content of the tables involved.
Yeah maybe. Do you remember what you did manually in your local cluster to manifest this slowness?
Yeah maybe. Do you remember what you did manually in your local cluster to manifest this slowness?
I didn't do anything in particular, but at the time I would have likely had the tpcc and tpch databases loaded. So, it might come down to the number and complexity of tables?
Describe the problem
The Django test suite takes 60-65 minutes with CockraochDB 23.1.x compared to 40-45 minutes with CockroachDB 22.2.x. Some attempts at improving performance were https://github.com/cockroachdb/cockroach/issues/93955 and https://github.com/cockroachdb/cockroach/issues/100871 but the issue remains.
To Reproduce
Running the
inspectdb
Django test app as an example (./runtests.py inspectdb --settings=test_roach
), the run time went from 31 seconds in 22.2.x to 40 seconds with 23.1.x. I turned on slow query logging to 1ms to log all queries. Then I wrote a script to parse the logs and group similar queries. 8 seconds of the 9-second performance difference are attributed to five groups of queries that usepg_table_is_visible
.Queries that include
pg_table_is_visible
when runninginspectdb
test app:Full queries:
Environment:
Jira issue: CRDB-30428