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

sql: optimize trigram generator #86610

Open
mgartner opened this issue Aug 22, 2022 · 2 comments
Open

sql: optimize trigram generator #86610

mgartner opened this issue Aug 22, 2022 · 2 comments
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-qa T-sql-queries SQL Queries Team
Projects

Comments

@mgartner
Copy link
Collaborator

mgartner commented Aug 22, 2022

The latency difference between our show_trgm builtin and Postgres's suggestions that there may be opportunities to optimize our trigram generation code. On my machine, the query select show_trgm('hello world') from generate_series(1, 10000); takes ~73ms in CRDB and ~14ms in PG.

Jira issue: CRDB-18836

@mgartner mgartner added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label Aug 22, 2022
@mgartner mgartner added this to Triage in SQL Queries via automation Aug 22, 2022
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Aug 22, 2022
@jordanlewis
Copy link
Member

Hm I wonder what this is about. Here's what the code does:

  1. find word boundaries
  2. copy each word into a new allocated buffer (maybe this is too wasteful?) if running with padding, which show_trgm would be
  3. make slices for all the trigrams
  4. sort the trigrams
  5. distinct the trigrams

@rytaft rytaft moved this from Triage to Backlog in SQL Queries Aug 23, 2022
@rytaft rytaft added the O-qa label Aug 23, 2022
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 26, 2024
@yuzefovich yuzefovich reopened this May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-qa T-sql-queries SQL Queries Team
Projects
Status: Backlog
SQL Queries
Backlog (DO NOT ADD NEW ISSUES)
Development

No branches or pull requests

4 participants