Skip to content
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

catalog: optimize schemaResolvers.LookupObject #135916

Open
tbg opened this issue Nov 21, 2024 · 0 comments
Open

catalog: optimize schemaResolvers.LookupObject #135916

tbg opened this issue Nov 21, 2024 · 0 comments
Labels
branch-master Failures and bugs on the master branch. C-performance Perf of queries or internals. Solution not expected to change functional behavior. o-perf-efficiency Related to performance efficiency P-2 Issues/test failures with a fix SLA of 3 months

Comments

@tbg
Copy link
Member

tbg commented Nov 21, 2024

6a7b1e2 oltp_read_only on reference roachprod cluster.

The problem here is that we have to allocate because we're using interfaces. See also #135905 - hopefully some refactoring or use of generics or in the worst case pooling can remove these classes of allocations from the SQL foundations codebase entirely.

----------------------------------------------------------+-------------
                                           1237068   100% |   github.com/cockroachdb/cockroach/pkg/sql/catalog/resolver.ResolveExisting pkg/sql/catalog/resolver/resolver.go:375
   1237068  0.78% 16.21%    1237068  0.78%                | github.com/cockroachdb/cockroach/pkg/sql.(*schemaResolver).LookupObject pkg/sql/schema_resolver.go:165
----------------------------------------------------------+-------------

Source:

/pkg/sql/schema_resolver.go#L165-L173

	tn := tree.MakeQualifiedTypeName(dbName, scName, obName) // <-- this
	switch flags.DesiredObjectKind {
	case tree.TableObject:
		prefix, desc, err = descs.PrefixAndTable(ctx, g, &tn)
	case tree.TypeObject:
		prefix, desc, err = descs.PrefixAndType(ctx, g, &tn)
	case tree.AnyObject:
		prefix, desc, err = descs.PrefixAndTable(ctx, g, &tn)
		if err != nil {

This seems easily pooled.

Epic: CRDB-42584

Jira issue: CRDB-44788

@tbg tbg added C-performance Perf of queries or internals. Solution not expected to change functional behavior. branch-master Failures and bugs on the master branch. P-2 Issues/test failures with a fix SLA of 3 months o-perf-efficiency Related to performance efficiency T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) labels Nov 21, 2024
@exalate-issue-sync exalate-issue-sync bot removed the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-master Failures and bugs on the master branch. C-performance Perf of queries or internals. Solution not expected to change functional behavior. o-perf-efficiency Related to performance efficiency P-2 Issues/test failures with a fix SLA of 3 months
Projects
None yet
Development

No branches or pull requests

1 participant