-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
sql: improve REGPROCEDURE cast performance #61082
Comments
It'd be great it this was backport-able to 20.2, but I'm not sure how realistic that is. |
this cast is implemented by issuing a separate query with the internal executor cockroach/pkg/sql/sem/tree/eval.go Lines 3753 to 3774 in 3bae09b
since the internal executor has a different (empty) descriptor collection than the conn_executor that is running the main query, this means that each cast operation causes descriptor lookups to be performed. we encountered essentially the same problem here: #59880 we should be able to do something similar and not use the internal executor to implement this cast. |
Roughly every use of the `InternalExecutor` in the `EvalContext` makes me sad. Do we need it? Could we remove it entirely? That doesn't mean we'd never delegate to it via some interface -- but also we should cut down on that. What are the important cases where we really need to delegate to the internal executor? |
ActiveRecord executes a query on the
pg_type
table when initiating a connection (full query below). This query has a filter with a::REGPROCEDURE
cast which is extremely slow to execute. Ideally we can improve the performance of this cast. Incockroach demo
this cast adds a few hundred milliseconds of latency to the query. In a multi-node cluster, it adds 2+ seconds of latency.Example (in
cockroach demo
).Complete ActiveRecord query
https://github.com/rails/rails/blob/b038bb27a6162184faef3af6e1c676a893651d9f/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L633
The text was updated successfully, but these errors were encountered: