Changes between Version 15 and Version 16 of AnalyticalStatisticalQuerying


Ignore:
Timestamp:
09/30/25 21:43:55 (13 days ago)
Author:
222077
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AnalyticalStatisticalQuerying

    v15 v16  
    271271
    272272=== Analysis (Optimizations) ===
    273  * Push selection down: filter `ticket` by `account_id` and `date_purchased` before joins to reduce data early.
    274  * Compute `weight` in a projection step before aggregation for clarity and efficiency.
    275  * Replace correlated subquery for `AVG` with a window function or single aggregation to avoid repeated scans.
    276  * Indexing opportunities:
     273Push selection down: filter `ticket` by `account_id` and `date_purchased` before joins to reduce data early.
     274Compute `weight` in a projection step before aggregation for clarity and efficiency.
     275Replace correlated subquery for `AVG` with a window function or single aggregation to avoid repeated scans.
     276Indexing opportunities:
    277277   - `ticket(account_id, date_purchased)` for fast filtering.
    278278   - Foreign key indexes on `ticket.trip_id`, `trip.route_id`, and `route.{from_location_id, to_location_id, transport_organizer_id}`.
     
    377377
    378378=== Analysis (Optimizations) ===
    379  * Push projections early: keep only `location_id`, `ticket_id`, `account_id`, `price`, and join keys before grouping.
    380  * Apply the date filter (`past year`) explicitly in the `WHERE` clause on `ticket.date_purchased` (missing in original).
    381  * Replace cross join with `stats` by using a window function (`AVG() OVER ()`) to avoid scanning `destinations` twice.
    382  * Indexing opportunities:
     379Push projections early: keep only `location_id`, `ticket_id`, `account_id`, `price`, and join keys before grouping.
     380Apply the date filter (`past year`) explicitly in the `WHERE` clause on `ticket.date_purchased` (missing in original).
     381Replace cross join with `stats` by using a window function (`AVG() OVER ()`) to avoid scanning `destinations` twice.
     382Indexing opportunities:
    383383   - `ticket(gets_off_location_id, date_purchased)`
    384384   - `student_ticket.ticket_id`, `child_ticket.ticket_id`
     
    470470
    471471=== Analysis (Optimizations) ===
    472  * Push projections early to reduce carried attributes before aggregation.
    473  * Join order: start with fact tables (`ticket`, `payment`) then join dimension tables (`trip`, `route`, `location`, `transport_organizer`).
    474  * The `max_tickets` CTE is redundant unless we need to filter only top seller(s).
    475  * Indexing opportunities:
     472Push projections early to reduce carried attributes before aggregation.
     473Join order: start with fact tables (`ticket`, `payment`) then join dimension tables (`trip`, `route`, `location`, `transport_organizer`).
     474The `max_tickets` CTE is redundant unless we need to filter only top seller(s).
     475Indexing opportunities:
    476476   - `ticket.trip_id`, `trip.route_id`, `ticket.payment_id`
    477477   - Foreign keys: `route.from_location_id`, `route.to_location_id`, `route.transport_organizer_id`