Calculate Duration On of multiple tags

Once you have that set up, the queries will use the lead() or lag() functions to get adjacent timestamps for deltas. In your case, you will need to use the PARTITION BY clause in your window functions so that the calculations are per-tagpath.

(I wouldn't store tagpaths directly in this table--make a joinable table that holds the full tag path and use that table's primary key in the event table.)

See this topic for an example:

(You would partition by event_tag_id instead of ACTOR.)