Changes between Version 12 and Version 13 of App


Ignore:
Timestamp:
09/08/25 23:47:08 (11 hours ago)
Author:
163080
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • App

    v12 v13  
    8787  - `idx_invoice_notifications_invoice_id`: Speeds up notification retrieval
    8888  - `idx_invoice_notifications_processed`: Partial index for unprocessed notifications
    89 
     89- Complex invoice analytics: (/agencyos/sql/04_complex_invoice_analytics_index.sql
     90  - `idx_invoice_complex_analytics`: Multi-column index for tenant-specific analytics with status, currency, monthly grouping, and amount filtering
     91  - `idx_invoice_overdue_analysis`: Optimized for overdue invoice queries with tenant, status, due date, and amount sorting
     92  - `idx_invoice_financial_reporting`: Quarterly financial reporting with currency, status, and amount categorization
     93  - `idx_invoice_number_search`: Case-insensitive invoice number search with tenant isolation
     94  - `idx_client_invoice_performance`: Client performance metrics with status-based priority ordering
     95  - `idx_invoice_temporal_analytics`: Time-series analysis with year, month, and day-of-week grouping
    9096
    9197Using `EXPLAIN` on the `Client` table
     
    107113}}}
    108114
     115Using `EXPLAIN` on complex invoice analytics
     116
     117  - Multi-tenant analytics query:
     118{{{
     119EXPLAIN ANALYZE
     120SELECT
     121    invoice_status,
     122    invoice_currency,
     123    DATE_TRUNC('month', invoice_issue_date) as month,
     124    SUM(invoice_total_amount) as total_amount,
     125    COUNT(*) as invoice_count
     126FROM "Invoice"
     127WHERE tenant_id = 'tenant_123'
     128  AND invoice_status IN ('PENDING', 'PROCESSING', 'OVERDUE', 'PAID')
     129  AND invoice_issue_date >= '2024-01-01'
     130  AND invoice_currency = 'EUR'
     131GROUP BY invoice_status, invoice_currency, DATE_TRUNC('month', invoice_issue_date)
     132ORDER BY month DESC, total_amount DESC;
     133}}}
     134
     135  - Result with complex index:
     136{{{
     137Index Only Scan using idx_invoice_complex_analytics on "Invoice"  (cost=0.14..12.49 rows=11 width=24)
     138  Index Cond: ((tenant_id = 'tenant_123') AND (invoice_currency = 'EUR'::"Currency") AND (invoice_issue_date >= '2024-01-01 00:00:00'::timestamp without time zone))
     139  Heap Fetches: 11
     140}}}
     141
    109142[[Image(https://develop.finki.ukim.mk/projects/agency-os/raw-attachment/wiki/App/index.jpg)]]