Changes between Version 14 and Version 15 of AnalyticalStatisticalQuerying


Ignore:
Timestamp:
09/30/25 20:44:20 (13 days ago)
Author:
222077
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AnalyticalStatisticalQuerying

    v14 v15  
    249249}}}
    250250
    251 == Results (Relational Algebra) ==
     251=== Results (Relational Algebra) ===
    252252{{{
    253253T1 = σ(account_id = 300 ∧ date_purchased ≥ CURRENT_DATE - 3m)(ticket)
     
    270270}}}
    271271
    272 == Analysis (Optimizations) ==
     272=== Analysis (Optimizations) ===
    273273 * Push selection down: filter `ticket` by `account_id` and `date_purchased` before joins to reduce data early.
    274274 * Compute `weight` in a projection step before aggregation for clarity and efficiency.
     
    278278   - Foreign key indexes on `ticket.trip_id`, `trip.route_id`, and `route.{from_location_id, to_location_id, transport_organizer_id}`.
    279279
    280 == Conclusion (Rewritten SQL) ==
     280=== Conclusion (Rewritten SQL) ===
    281281{{{
    282282WITH route_scores AS (
     
    356356}}}
    357357
    358 == Results (Relational Algebra) ==
     358=== Results (Relational Algebra) ===
    359359{{{
    360360J1 = location ⨝ ticket (l.location_id = t.gets_off_location_id)
     
    376376}}}
    377377
    378 == Analysis (Optimizations) ==
     378=== Analysis (Optimizations) ===
    379379 * Push projections early: keep only `location_id`, `ticket_id`, `account_id`, `price`, and join keys before grouping.
    380380 * Apply the date filter (`past year`) explicitly in the `WHERE` clause on `ticket.date_purchased` (missing in original).
     
    385385   - Foreign keys on `trip.route_id`, `trip.transport_organizer_id`.
    386386
    387 == Conclusion (Rewritten SQL) ==
     387=== Conclusion (Rewritten SQL) ===
    388388{{{
    389389WITH destinations AS (
     
    450450}}}
    451451
    452 == Results (Relational Algebra) ==
     452=== Results (Relational Algebra) ===
    453453{{{
    454454J1 = route ⨝ transport_organizer
     
    469469}}}
    470470
    471 == Analysis (Optimizations) ==
     471=== Analysis (Optimizations) ===
    472472 * Push projections early to reduce carried attributes before aggregation.
    473473 * Join order: start with fact tables (`ticket`, `payment`) then join dimension tables (`trip`, `route`, `location`, `transport_organizer`).
     
    477477   - Foreign keys: `route.from_location_id`, `route.to_location_id`, `route.transport_organizer_id`
    478478
    479 == Conclusion (Rewritten SQL) ==
     479=== Conclusion (Rewritten SQL) ===
    480480{{{
    481481CREATE VIEW top_selling_routes_view AS