Skip to content

Conversation

@altimin
Copy link
Collaborator

@altimin altimin commented Nov 25, 2025

and also make it faster.

The current implementation takes ~250ms on example Chrome trace:

select
  slice_id as sliceId,
  ts,
  'slice' as source,
  track_id as sourceId,
  0 as utid
from slice
join args using(arg_set_id)
where string_value glob '*[mM][aA][iI][nN]*' or key glob '*[mM][aA][iI][nN]*'

Naive support for ints would take ~320ms:

select
  slice_id as sliceId,
  ts,
  'slice' as source,
  track_id as sourceId,
  0 as utid
from slice
join args using(arg_set_id)
where display_value glob '*[mM][aA][iI][nN]*' or key glob '*[mM][aA][iI][nN]*'

This patch filters args first, taking the total time down to 90ms:

select
  slice_id as sliceId,
  ts,
  'slice' as source,
  track_id as sourceId,
  0 as utid
from slice
join (
  select arg_set_id from args where display_value glob '*[mM][aA][iI][nN]*'
  union
  select arg_set_id from args where key glob '*[mM][aA][iI][nN]*'
) using (arg_set_id)

and also make it faster.

The current implementation takes ~250ms on example Chrome trace:

```
select
  slice_id as sliceId,
  ts,
  'slice' as source,
  track_id as sourceId,
  0 as utid
from slice
join args using(arg_set_id)
where string_value glob '*[mM][aA][iI][nN]*' or key glob '*[mM][aA][iI][nN]*'
```

Naive support for ints would take ~320ms:
```
select
  slice_id as sliceId,
  ts,
  'slice' as source,
  track_id as sourceId,
  0 as utid
from slice
join args using(arg_set_id)
where display_value glob '*[mM][aA][iI][nN]*' or key glob '*[mM][aA][iI][nN]*'
```

This patch filters `args` first, taking the total time down to 90ms:
```
select
  slice_id as sliceId,
  ts,
  'slice' as source,
  track_id as sourceId,
  0 as utid
from slice
join (
  select arg_set_id from args where display_value glob '*[mM][aA][iI][nN]*'
  union
  select arg_set_id from args where key glob '*[mM][aA][iI][nN]*'
) using (arg_set_id)
```
@altimin altimin requested a review from a team as a code owner November 25, 2025 19:58
@altimin altimin requested a review from stevegolton November 25, 2025 19:59
@github-actions
Copy link

🎨 Perfetto UI Build

✅ UI build is ready: https://storage.googleapis.com/perfetto-ci-artifacts/gh-19682425044-ui/ui/index.html

Copy link
Member

@stevegolton stevegolton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we park this for now. We have some concerns:

  • How display_value scales, IIUC it's an SQL expression.
  • The optimization is a hack based on the current foibles of the query planner.

@LalitMaganti knows more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants