Skip to content

Commit

Permalink
Merge "Use indexes for flow table" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Timin authored and Gerrit Code Review committed Aug 23, 2024
2 parents 600e08e + 61af8ec commit 247bcf7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/trace_processor/perfetto_sql/stdlib/slices/flow.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@

INCLUDE PERFETTO MODULE graphs.search;

-- It's very typical to filter the flow table on either incoming or outgoing slice ids.
--
-- Ideally, this should be automatic and shouldn't require any additional imports, however we
-- can't add it to prelude (because it is initialised before the trace is loaded and the indexes
-- are not rebuilt when the new data is loaded), so the interested parties should remember to import
-- this module.
CREATE PERFETTO INDEX flow_in ON flow(slice_in);
CREATE PERFETTO INDEX flow_out ON flow(slice_out);

-- Computes the "reachable" set of slices from the |flows| table, starting from slice ids
-- specified in |source_table|. This provides a more efficient result than with the in-built
-- following_flow operator.
Expand Down
3 changes: 3 additions & 0 deletions ui/src/controller/flow_events_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ export class FlowEventsController extends Controller<'main'> {
: `directly_connected_flow(${sliceId})`;

const query = `
-- Include slices.flow to initialise indexes on 'flow.slice_in' and 'flow.slice_out'.
INCLUDE PERFETTO MODULE slices.flow;
select
f.slice_out as beginSliceId,
t1.track_id as beginTrackId,
Expand Down

0 comments on commit 247bcf7

Please sign in to comment.