{
  "Plan": {
    "Node Type": "Limit",
    "Parallel Aware": false,
    "Async Capable": false,
    "Startup Cost": 62612.93,
    "Total Cost": 62613.75,
    "Plan Rows": 1,
    "Plan Width": 573,
    "Actual Rows": 51,
    "Actual Loops": 1,
    "Shared Hit Blocks": 3496,
    "Shared Read Blocks": 35430,
    "Shared Dirtied Blocks": 0,
    "Shared Written Blocks": 0,
    "Local Hit Blocks": 0,
    "Local Read Blocks": 0,
    "Local Dirtied Blocks": 0,
    "Local Written Blocks": 0,
    "Temp Read Blocks": 4013,
    "Temp Written Blocks": 2776,
    "Plans": [
      {
        "Node Type": "Unique",
        "Parent Relationship": "InitPlan",
        "Subplan Name": "CTE canonical_revenue",
        "Parallel Aware": false,
        "Async Capable": false,
        "Startup Cost": 54671.32,
        "Total Cost": 56126.02,
        "Plan Rows": 19396,
        "Plan Width": 64,
        "Actual Rows": 193938,
        "Actual Loops": 1,
        "Shared Hit Blocks": 0,
        "Shared Read Blocks": 22584,
        "Shared Dirtied Blocks": 0,
        "Shared Written Blocks": 0,
        "Local Hit Blocks": 0,
        "Local Read Blocks": 0,
        "Local Dirtied Blocks": 0,
        "Local Written Blocks": 0,
        "Temp Read Blocks": 1246,
        "Temp Written Blocks": 1251,
        "Plans": [
          {
            "Node Type": "Sort",
            "Parent Relationship": "Outer",
            "Parallel Aware": false,
            "Async Capable": false,
            "Startup Cost": 54671.32,
            "Total Cost": 55156.22,
            "Plan Rows": 193960,
            "Plan Width": 64,
            "Actual Rows": 193960,
            "Actual Loops": 1,
            "Sort Key": [
              "r_2.mops_company_id",
              "r_2.period",
              "r_2.revision DESC"
            ],
            "Sort Method": "external merge",
            "Sort Space Used": 9968,
            "Sort Space Type": "Disk",
            "Shared Hit Blocks": 0,
            "Shared Read Blocks": 22584,
            "Shared Dirtied Blocks": 0,
            "Shared Written Blocks": 0,
            "Local Hit Blocks": 0,
            "Local Read Blocks": 0,
            "Local Dirtied Blocks": 0,
            "Local Written Blocks": 0,
            "Temp Read Blocks": 1246,
            "Temp Written Blocks": 1251,
            "Plans": [
              {
                "Node Type": "Seq Scan",
                "Parent Relationship": "Outer",
                "Parallel Aware": false,
                "Async Capable": false,
                "Relation Name": "mops_monthly_revenue",
                "Alias": "r_2",
                "Startup Cost": 0.0,
                "Total Cost": 30342.4,
                "Plan Rows": 193960,
                "Plan Width": 64,
                "Actual Rows": 193960,
                "Actual Loops": 1,
                "Filter": "(currency = 'TWD'::text)",
                "Rows Removed by Filter": 0,
                "Shared Hit Blocks": 0,
                "Shared Read Blocks": 22584,
                "Shared Dirtied Blocks": 0,
                "Shared Written Blocks": 0,
                "Local Hit Blocks": 0,
                "Local Read Blocks": 0,
                "Local Dirtied Blocks": 0,
                "Local Written Blocks": 0,
                "Temp Read Blocks": 0,
                "Temp Written Blocks": 0
              }
            ]
          }
        ]
      },
      {
        "Node Type": "Aggregate",
        "Strategy": "Hashed",
        "Partial Mode": "Simple",
        "Parent Relationship": "InitPlan",
        "Subplan Name": "CTE latest_period",
        "Parallel Aware": false,
        "Async Capable": false,
        "Startup Cost": 533.39,
        "Total Cost": 535.39,
        "Plan Rows": 200,
        "Plan Width": 24,
        "Actual Rows": 1987,
        "Actual Loops": 1,
        "Group Key": [
          "canonical_revenue.mops_company_id"
        ],
        "Planned Partitions": 0,
        "HashAgg Batches": 1,
        "Peak Memory Usage": 385,
        "Disk Usage": 0,
        "Shared Hit Blocks": 0,
        "Shared Read Blocks": 0,
        "Shared Dirtied Blocks": 0,
        "Shared Written Blocks": 0,
        "Local Hit Blocks": 0,
        "Local Read Blocks": 0,
        "Local Dirtied Blocks": 0,
        "Local Written Blocks": 0,
        "Temp Read Blocks": 789,
        "Temp Written Blocks": 1242,
        "Plans": [
          {
            "Node Type": "CTE Scan",
            "Parent Relationship": "Outer",
            "Parallel Aware": false,
            "Async Capable": false,
            "CTE Name": "canonical_revenue",
            "Alias": "canonical_revenue",
            "Startup Cost": 0.0,
            "Total Cost": 387.92,
            "Plan Rows": 19396,
            "Plan Width": 24,
            "Actual Rows": 193938,
            "Actual Loops": 1,
            "Shared Hit Blocks": 0,
            "Shared Read Blocks": 0,
            "Shared Dirtied Blocks": 0,
            "Shared Written Blocks": 0,
            "Local Hit Blocks": 0,
            "Local Read Blocks": 0,
            "Local Dirtied Blocks": 0,
            "Local Written Blocks": 0,
            "Temp Read Blocks": 789,
            "Temp Written Blocks": 1242
          }
        ]
      },
      {
        "Node Type": "Result",
        "Parent Relationship": "Outer",
        "Parallel Aware": false,
        "Async Capable": false,
        "Startup Cost": 5951.52,
        "Total Cost": 5952.33,
        "Plan Rows": 1,
        "Plan Width": 573,
        "Actual Rows": 51,
        "Actual Loops": 1,
        "Shared Hit Blocks": 3496,
        "Shared Read Blocks": 35430,
        "Shared Dirtied Blocks": 0,
        "Shared Written Blocks": 0,
        "Local Hit Blocks": 0,
        "Local Read Blocks": 0,
        "Local Dirtied Blocks": 0,
        "Local Written Blocks": 0,
        "Temp Read Blocks": 4013,
        "Temp Written Blocks": 2776,
        "Plans": [
          {
            "Node Type": "Sort",
            "Parent Relationship": "Outer",
            "Parallel Aware": false,
            "Async Capable": false,
            "Startup Cost": 5951.52,
            "Total Cost": 5951.52,
            "Plan Rows": 1,
            "Plan Width": 541,
            "Actual Rows": 51,
            "Actual Loops": 1,
            "Sort Key": [
              "(round(((((('10'::numeric + LEAST('20'::numeric, (GREATEST('0'::numeric, (((power((((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 1))) / NULLIF((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 3))), '0'::numeric)))::double precision, '0.5'::double precision) - '1'::double precision) * '100'::double precision))::numeric) / '5'::numeric))) + LEAST('20'::numeric, (GREATEST('0'::numeric, ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric)) / '5'::numeric))) + LEAST('15'::numeric, (GREATEST('0'::numeric, ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 2)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric)) / 6.6666667))) + GREATEST('0'::numeric, ('20'::numeric - ((snapshot.market_capitalization / NULLIF(((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index)))) * ('1'::numeric + (LEAST('500'::numeric, GREATEST('0'::numeric, (((((((power((((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 1))) / NULLIF((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 3))), '0'::numeric)))::double precision, '0.5'::double precision) - '1'::double precision) * '100'::double precision))::numeric + ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric)) + ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 2)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric)) - GREATEST((((power((((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 1))) / NULLIF((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 3))), '0'::numeric)))::double precision, '0.5'::double precision) - '1'::double precision) * '100'::double precision))::numeric, ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric), ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 2)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric))) - LEAST((((power((((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 1))) / NULLIF((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 3))), '0'::numeric)))::double precision, '0.5'::double precision) - '1'::double precision) * '100'::double precision))::numeric, ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric), ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 2)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric))))) / '100'::numeric))), '0'::numeric)) * '2'::numeric)))) + GREATEST('0'::numeric, ('15'::numeric - ((snapshot.market_capitalization / NULLIF((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index)))), '0'::numeric)) / '4'::numeric)))), 1)) DESC NULLS LAST",
              "c.mops_code"
            ],
            "Sort Method": "quicksort",
            "Sort Space Used": 51,
            "Sort Space Type": "Memory",
            "Shared Hit Blocks": 3496,
            "Shared Read Blocks": 35430,
            "Shared Dirtied Blocks": 0,
            "Shared Written Blocks": 0,
            "Local Hit Blocks": 0,
            "Local Read Blocks": 0,
            "Local Dirtied Blocks": 0,
            "Local Written Blocks": 0,
            "Temp Read Blocks": 4013,
            "Temp Written Blocks": 2776,
            "Plans": [
              {
                "Node Type": "WindowAgg",
                "Parent Relationship": "Outer",
                "Parallel Aware": false,
                "Async Capable": false,
                "Startup Cost": 2424.77,
                "Total Cost": 5951.51,
                "Plan Rows": 1,
                "Plan Width": 541,
                "Actual Rows": 51,
                "Actual Loops": 1,
                "Shared Hit Blocks": 3490,
                "Shared Read Blocks": 35430,
                "Shared Dirtied Blocks": 0,
                "Shared Written Blocks": 0,
                "Local Hit Blocks": 0,
                "Local Read Blocks": 0,
                "Local Dirtied Blocks": 0,
                "Local Written Blocks": 0,
                "Temp Read Blocks": 4013,
                "Temp Written Blocks": 2776,
                "Plans": [
                  {
                    "Node Type": "Nested Loop",
                    "Parent Relationship": "Outer",
                    "Parallel Aware": false,
                    "Async Capable": false,
                    "Join Type": "Left",
                    "Startup Cost": 2424.77,
                    "Total Cost": 5951.16,
                    "Plan Rows": 1,
                    "Plan Width": 313,
                    "Actual Rows": 51,
                    "Actual Loops": 1,
                    "Inner Unique": false,
                    "Join Filter": "(candle.session_date = snapshot.session_date)",
                    "Rows Removed by Join Filter": 175018,
                    "Shared Hit Blocks": 3490,
                    "Shared Read Blocks": 35430,
                    "Shared Dirtied Blocks": 0,
                    "Shared Written Blocks": 0,
                    "Local Hit Blocks": 0,
                    "Local Read Blocks": 0,
                    "Local Dirtied Blocks": 0,
                    "Local Written Blocks": 0,
                    "Temp Read Blocks": 4013,
                    "Temp Written Blocks": 2776,
                    "Plans": [
                      {
                        "Node Type": "Nested Loop",
                        "Parent Relationship": "Outer",
                        "Parallel Aware": false,
                        "Async Capable": false,
                        "Join Type": "Left",
                        "Startup Cost": 2364.8,
                        "Total Cost": 2463.52,
                        "Plan Rows": 1,
                        "Plan Width": 321,
                        "Actual Rows": 51,
                        "Actual Loops": 1,
                        "Inner Unique": false,
                        "Join Filter": "(series.source_id = source.id)",
                        "Rows Removed by Join Filter": 0,
                        "Shared Hit Blocks": 887,
                        "Shared Read Blocks": 22856,
                        "Shared Dirtied Blocks": 0,
                        "Shared Written Blocks": 0,
                        "Local Hit Blocks": 0,
                        "Local Read Blocks": 0,
                        "Local Dirtied Blocks": 0,
                        "Local Written Blocks": 0,
                        "Temp Read Blocks": 4013,
                        "Temp Written Blocks": 2776,
                        "Plans": [
                          {
                            "Node Type": "Nested Loop",
                            "Parent Relationship": "Outer",
                            "Parallel Aware": false,
                            "Async Capable": false,
                            "Join Type": "Inner",
                            "Startup Cost": 2364.52,
                            "Total Cost": 2458.91,
                            "Plan Rows": 1,
                            "Plan Width": 337,
                            "Actual Rows": 51,
                            "Actual Loops": 1,
                            "Inner Unique": true,
                            "Join Filter": "((source.id = snapshot.source_id) AND ((snapshot.market_capitalization / NULLIF((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index)))), '0'::numeric)) <= '60'::numeric) AND ((snapshot.market_capitalization / NULLIF(((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index)))) * ('1'::numeric + (LEAST('500'::numeric, GREATEST('0'::numeric, (((((((power((((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 1))) / NULLIF((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 3))), '0'::numeric)))::double precision, '0.5'::double precision) - '1'::double precision) * '100'::double precision))::numeric + ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric)) + ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 2)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric)) - GREATEST((((power((((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 1))) / NULLIF((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 3))), '0'::numeric)))::double precision, '0.5'::double precision) - '1'::double precision) * '100'::double precision))::numeric, ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric), ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 2)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric))) - LEAST((((power((((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 1))) / NULLIF((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 3))), '0'::numeric)))::double precision, '0.5'::double precision) - '1'::double precision) * '100'::double precision))::numeric, ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric), ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 2)) AND (r.month_index <= lp.latest_month_index)))) - (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))) / NULLIF(abs((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))))), '0'::numeric)) * '100'::numeric))))) / '100'::numeric))), '0'::numeric)) <= '10'::numeric))",
                            "Rows Removed by Join Filter": 3,
                            "Shared Hit Blocks": 812,
                            "Shared Read Blocks": 22777,
                            "Shared Dirtied Blocks": 0,
                            "Shared Written Blocks": 0,
                            "Local Hit Blocks": 0,
                            "Local Read Blocks": 0,
                            "Local Dirtied Blocks": 0,
                            "Local Written Blocks": 0,
                            "Temp Read Blocks": 4013,
                            "Temp Written Blocks": 2776,
                            "Plans": [
                              {
                                "Node Type": "Nested Loop",
                                "Parent Relationship": "Outer",
                                "Parallel Aware": false,
                                "Async Capable": false,
                                "Join Type": "Inner",
                                "Startup Cost": 2364.24,
                                "Total Cost": 2455.72,
                                "Plan Rows": 1,
                                "Plan Width": 318,
                                "Actual Rows": 73,
                                "Actual Loops": 1,
                                "Inner Unique": false,
                                "Shared Hit Blocks": 673,
                                "Shared Read Blocks": 22697,
                                "Shared Dirtied Blocks": 0,
                                "Shared Written Blocks": 0,
                                "Local Hit Blocks": 0,
                                "Local Read Blocks": 0,
                                "Local Dirtied Blocks": 0,
                                "Local Written Blocks": 0,
                                "Temp Read Blocks": 4013,
                                "Temp Written Blocks": 2776,
                                "Plans": [
                                  {
                                    "Node Type": "Nested Loop",
                                    "Parent Relationship": "Outer",
                                    "Parallel Aware": false,
                                    "Async Capable": false,
                                    "Join Type": "Inner",
                                    "Startup Cost": 2364.24,
                                    "Total Cost": 2454.62,
                                    "Plan Rows": 1,
                                    "Plan Width": 302,
                                    "Actual Rows": 73,
                                    "Actual Loops": 1,
                                    "Inner Unique": true,
                                    "Join Filter": "(instrument.venue_id = venue.id)",
                                    "Rows Removed by Join Filter": 0,
                                    "Shared Hit Blocks": 600,
                                    "Shared Read Blocks": 22697,
                                    "Shared Dirtied Blocks": 0,
                                    "Shared Written Blocks": 0,
                                    "Local Hit Blocks": 0,
                                    "Local Read Blocks": 0,
                                    "Local Dirtied Blocks": 0,
                                    "Local Written Blocks": 0,
                                    "Temp Read Blocks": 4013,
                                    "Temp Written Blocks": 2776,
                                    "Plans": [
                                      {
                                        "Node Type": "Nested Loop",
                                        "Parent Relationship": "Outer",
                                        "Parallel Aware": false,
                                        "Async Capable": false,
                                        "Join Type": "Inner",
                                        "Startup Cost": 2364.24,
                                        "Total Cost": 2453.55,
                                        "Plan Rows": 1,
                                        "Plan Width": 318,
                                        "Actual Rows": 73,
                                        "Actual Loops": 1,
                                        "Inner Unique": false,
                                        "Shared Hit Blocks": 527,
                                        "Shared Read Blocks": 22697,
                                        "Shared Dirtied Blocks": 0,
                                        "Shared Written Blocks": 0,
                                        "Local Hit Blocks": 0,
                                        "Local Read Blocks": 0,
                                        "Local Dirtied Blocks": 0,
                                        "Local Written Blocks": 0,
                                        "Temp Read Blocks": 4013,
                                        "Temp Written Blocks": 2776,
                                        "Plans": [
                                          {
                                            "Node Type": "Nested Loop",
                                            "Parent Relationship": "Outer",
                                            "Parallel Aware": false,
                                            "Async Capable": false,
                                            "Join Type": "Inner",
                                            "Startup Cost": 2363.95,
                                            "Total Cost": 2450.27,
                                            "Plan Rows": 1,
                                            "Plan Width": 302,
                                            "Actual Rows": 73,
                                            "Actual Loops": 1,
                                            "Inner Unique": true,
                                            "Join Filter": "(a.mops_company_id = c.id)",
                                            "Rows Removed by Join Filter": 0,
                                            "Shared Hit Blocks": 383,
                                            "Shared Read Blocks": 22621,
                                            "Shared Dirtied Blocks": 0,
                                            "Shared Written Blocks": 0,
                                            "Local Hit Blocks": 0,
                                            "Local Read Blocks": 0,
                                            "Local Dirtied Blocks": 0,
                                            "Local Written Blocks": 0,
                                            "Temp Read Blocks": 4013,
                                            "Temp Written Blocks": 2776,
                                            "Plans": [
                                              {
                                                "Node Type": "Nested Loop",
                                                "Parent Relationship": "Outer",
                                                "Parallel Aware": false,
                                                "Async Capable": false,
                                                "Join Type": "Inner",
                                                "Startup Cost": 2363.67,
                                                "Total Cost": 2441.96,
                                                "Plan Rows": 1,
                                                "Plan Width": 272,
                                                "Actual Rows": 137,
                                                "Actual Loops": 1,
                                                "Inner Unique": true,
                                                "Join Filter": "(lp.mops_company_id = a.mops_company_id)",
                                                "Rows Removed by Join Filter": 97892,
                                                "Shared Hit Blocks": 9,
                                                "Shared Read Blocks": 22584,
                                                "Shared Dirtied Blocks": 0,
                                                "Shared Written Blocks": 0,
                                                "Local Hit Blocks": 0,
                                                "Local Read Blocks": 0,
                                                "Local Dirtied Blocks": 0,
                                                "Local Written Blocks": 0,
                                                "Temp Read Blocks": 4013,
                                                "Temp Written Blocks": 2776,
                                                "Plans": [
                                                  {
                                                    "Node Type": "Aggregate",
                                                    "Strategy": "Sorted",
                                                    "Partial Mode": "Simple",
                                                    "Parent Relationship": "Outer",
                                                    "Parallel Aware": false,
                                                    "Async Capable": false,
                                                    "Startup Cost": 759.96,
                                                    "Total Cost": 837.02,
                                                    "Plan Rows": 1,
                                                    "Plan Width": 184,
                                                    "Actual Rows": 400,
                                                    "Actual Loops": 1,
                                                    "Group Key": [
                                                      "lp.mops_company_id",
                                                      "lp.latest_revenue_period",
                                                      "lp.latest_month_index"
                                                    ],
                                                    "Filter": "((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index))) > '0'::numeric) AND (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))) > '0'::numeric) AND (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 2)) AND (r.month_index <= lp.latest_month_index))) > '0'::numeric) AND (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))) > '0'::numeric) AND (sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index))) >= '1000000000'::numeric) AND (count(*) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index))) = 12) AND (count(*) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12)))) = 12) AND (count(*) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 2)) AND (r.month_index <= lp.latest_month_index))) = 3) AND (count(*) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12)))) = 3) AND ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 11)) AND (r.month_index <= lp.latest_month_index))) - sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12))))) / NULLIF(abs(sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 23)) AND (r.month_index <= (lp.latest_month_index - 12))))), '0'::numeric)) * '100'::numeric) >= '20'::numeric) AND ((((sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 2)) AND (r.month_index <= lp.latest_month_index))) - sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12))))) / NULLIF(abs(sum(r.revenue_twd) FILTER (WHERE ((r.month_index >= (lp.latest_month_index - 14)) AND (r.month_index <= (lp.latest_month_index - 12))))), '0'::numeric)) * '100'::numeric) >= '20'::numeric))",
                                                    "Rows Removed by Filter": 1582,
                                                    "Shared Hit Blocks": 9,
                                                    "Shared Read Blocks": 22584,
                                                    "Shared Dirtied Blocks": 0,
                                                    "Shared Written Blocks": 0,
                                                    "Local Hit Blocks": 0,
                                                    "Local Read Blocks": 0,
                                                    "Local Dirtied Blocks": 0,
                                                    "Local Written Blocks": 0,
                                                    "Temp Read Blocks": 2770,
                                                    "Temp Written Blocks": 2776,
                                                    "Plans": [
                                                      {
                                                        "Node Type": "Sort",
                                                        "Parent Relationship": "Outer",
                                                        "Parallel Aware": false,
                                                        "Async Capable": false,
                                                        "Startup Cost": 759.96,
                                                        "Total Cost": 761.76,
                                                        "Plan Rows": 722,
                                                        "Plan Width": 60,
                                                        "Actual Rows": 47128,
                                                        "Actual Loops": 1,
                                                        "Sort Key": [
                                                          "lp.mops_company_id",
                                                          "lp.latest_revenue_period",
                                                          "lp.latest_month_index"
                                                        ],
                                                        "Sort Method": "external merge",
                                                        "Sort Space Used": 2248,
                                                        "Sort Space Type": "Disk",
                                                        "Shared Hit Blocks": 9,
                                                        "Shared Read Blocks": 22584,
                                                        "Shared Dirtied Blocks": 0,
                                                        "Shared Written Blocks": 0,
                                                        "Local Hit Blocks": 0,
                                                        "Local Read Blocks": 0,
                                                        "Local Dirtied Blocks": 0,
                                                        "Local Written Blocks": 0,
                                                        "Temp Read Blocks": 2770,
                                                        "Temp Written Blocks": 2776,
                                                        "Plans": [
                                                          {
                                                            "Node Type": "Hash Join",
                                                            "Parent Relationship": "Outer",
                                                            "Parallel Aware": false,
                                                            "Async Capable": false,
                                                            "Join Type": "Inner",
                                                            "Startup Cost": 5.84,
                                                            "Total Cost": 725.68,
                                                            "Plan Rows": 722,
                                                            "Plan Width": 60,
                                                            "Actual Rows": 47128,
                                                            "Actual Loops": 1,
                                                            "Inner Unique": false,
                                                            "Hash Cond": "(r.mops_company_id = lp.mops_company_id)",
                                                            "Join Filter": "((r.month_index <= lp.latest_month_index) AND (r.month_index >= (lp.latest_month_index - 23)))",
                                                            "Rows Removed by Join Filter": 146296,
                                                            "Shared Hit Blocks": 0,
                                                            "Shared Read Blocks": 22584,
                                                            "Shared Dirtied Blocks": 0,
                                                            "Shared Written Blocks": 0,
                                                            "Local Hit Blocks": 0,
                                                            "Local Read Blocks": 0,
                                                            "Local Dirtied Blocks": 0,
                                                            "Local Written Blocks": 0,
                                                            "Temp Read Blocks": 2489,
                                                            "Temp Written Blocks": 2494,
                                                            "Plans": [
                                                              {
                                                                "Node Type": "CTE Scan",
                                                                "Parent Relationship": "Outer",
                                                                "Parallel Aware": false,
                                                                "Async Capable": false,
                                                                "CTE Name": "canonical_revenue",
                                                                "Alias": "r",
                                                                "Startup Cost": 0.0,
                                                                "Total Cost": 387.92,
                                                                "Plan Rows": 19396,
                                                                "Plan Width": 52,
                                                                "Actual Rows": 193938,
                                                                "Actual Loops": 1,
                                                                "Shared Hit Blocks": 0,
                                                                "Shared Read Blocks": 22584,
                                                                "Shared Dirtied Blocks": 0,
                                                                "Shared Written Blocks": 0,
                                                                "Local Hit Blocks": 0,
                                                                "Local Read Blocks": 0,
                                                                "Local Dirtied Blocks": 0,
                                                                "Local Written Blocks": 0,
                                                                "Temp Read Blocks": 1700,
                                                                "Temp Written Blocks": 1252
                                                              },
                                                              {
                                                                "Node Type": "Hash",
                                                                "Parent Relationship": "Inner",
                                                                "Parallel Aware": false,
                                                                "Async Capable": false,
                                                                "Startup Cost": 5.0,
                                                                "Total Cost": 5.0,
                                                                "Plan Rows": 67,
                                                                "Plan Width": 24,
                                                                "Actual Rows": 1982,
                                                                "Actual Loops": 1,
                                                                "Hash Buckets": 2048,
                                                                "Original Hash Buckets": 1024,
                                                                "Hash Batches": 1,
                                                                "Original Hash Batches": 1,
                                                                "Peak Memory Usage": 125,
                                                                "Shared Hit Blocks": 0,
                                                                "Shared Read Blocks": 0,
                                                                "Shared Dirtied Blocks": 0,
                                                                "Shared Written Blocks": 0,
                                                                "Local Hit Blocks": 0,
                                                                "Local Read Blocks": 0,
                                                                "Local Dirtied Blocks": 0,
                                                                "Local Written Blocks": 0,
                                                                "Temp Read Blocks": 789,
                                                                "Temp Written Blocks": 1242,
                                                                "Plans": [
                                                                  {
                                                                    "Node Type": "CTE Scan",
                                                                    "Parent Relationship": "Outer",
                                                                    "Parallel Aware": false,
                                                                    "Async Capable": false,
                                                                    "CTE Name": "latest_period",
                                                                    "Alias": "lp",
                                                                    "Startup Cost": 0.0,
                                                                    "Total Cost": 5.0,
                                                                    "Plan Rows": 67,
                                                                    "Plan Width": 24,
                                                                    "Actual Rows": 1982,
                                                                    "Actual Loops": 1,
                                                                    "Filter": "(('2026-11-02'::date - latest_revenue_period) <= 90)",
                                                                    "Rows Removed by Filter": 5,
                                                                    "Shared Hit Blocks": 0,
                                                                    "Shared Read Blocks": 0,
                                                                    "Shared Dirtied Blocks": 0,
                                                                    "Shared Written Blocks": 0,
                                                                    "Local Hit Blocks": 0,
                                                                    "Local Read Blocks": 0,
                                                                    "Local Dirtied Blocks": 0,
                                                                    "Local Written Blocks": 0,
                                                                    "Temp Read Blocks": 789,
                                                                    "Temp Written Blocks": 1242
                                                                  }
                                                                ]
                                                              }
                                                            ]
                                                          }
                                                        ]
                                                      }
                                                    ]
                                                  },
                                                  {
                                                    "Node Type": "Aggregate",
                                                    "Strategy": "Sorted",
                                                    "Partial Mode": "Simple",
                                                    "Parent Relationship": "Inner",
                                                    "Parallel Aware": false,
                                                    "Async Capable": false,
                                                    "Startup Cost": 1603.72,
                                                    "Total Cost": 1604.92,
                                                    "Plan Rows": 1,
                                                    "Plan Width": 124,
                                                    "Actual Rows": 245,
                                                    "Actual Loops": 400,
                                                    "Group Key": [
                                                      "a.mops_company_id"
                                                    ],
                                                    "Filter": "((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 1)) > '0'::numeric) AND (max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 2)) > '0'::numeric) AND (max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 3)) > '0'::numeric) AND (max(a.revenue_year) FILTER (WHERE ((row_number() OVER (?)) = 1)) = (max(a.revenue_year) FILTER (WHERE ((row_number() OVER (?)) = 2)) + 1)) AND (max(a.revenue_year) FILTER (WHERE ((row_number() OVER (?)) = 2)) = (max(a.revenue_year) FILTER (WHERE ((row_number() OVER (?)) = 3)) + 1)) AND ((((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 2)) - max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 3))) / NULLIF(abs(max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 3))), '0'::numeric)) * '100'::numeric) >= '10'::numeric) AND ((((max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 1)) - max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 2))) / NULLIF(abs(max(a.annual_revenue) FILTER (WHERE ((row_number() OVER (?)) = 2))), '0'::numeric)) * '100'::numeric) >= '10'::numeric))",
                                                    "Rows Removed by Filter": 1369,
                                                    "Shared Hit Blocks": 0,
                                                    "Shared Read Blocks": 0,
                                                    "Shared Dirtied Blocks": 0,
                                                    "Shared Written Blocks": 0,
                                                    "Local Hit Blocks": 0,
                                                    "Local Read Blocks": 0,
                                                    "Local Dirtied Blocks": 0,
                                                    "Local Written Blocks": 0,
                                                    "Temp Read Blocks": 1243,
                                                    "Temp Written Blocks": 0,
                                                    "Plans": [
                                                      {
                                                        "Node Type": "WindowAgg",
                                                        "Parent Relationship": "Outer",
                                                        "Parallel Aware": false,
                                                        "Async Capable": false,
                                                        "Startup Cost": 1603.72,
                                                        "Total Cost": 1603.92,
                                                        "Plan Rows": 10,
                                                        "Plan Width": 68,
                                                        "Actual Rows": 4743,
                                                        "Actual Loops": 400,
                                                        "Run Condition": "(row_number() OVER (?) <= 3)",
                                                        "Shared Hit Blocks": 0,
                                                        "Shared Read Blocks": 0,
                                                        "Shared Dirtied Blocks": 0,
                                                        "Shared Written Blocks": 0,
                                                        "Local Hit Blocks": 0,
                                                        "Local Read Blocks": 0,
                                                        "Local Dirtied Blocks": 0,
                                                        "Local Written Blocks": 0,
                                                        "Temp Read Blocks": 1243,
                                                        "Temp Written Blocks": 0,
                                                        "Plans": [
                                                          {
                                                            "Node Type": "Sort",
                                                            "Parent Relationship": "Outer",
                                                            "Parallel Aware": false,
                                                            "Async Capable": false,
                                                            "Startup Cost": 1603.72,
                                                            "Total Cost": 1603.74,
                                                            "Plan Rows": 10,
                                                            "Plan Width": 52,
                                                            "Actual Rows": 11993,
                                                            "Actual Loops": 400,
                                                            "Sort Key": [
                                                              "a.mops_company_id",
                                                              "a.revenue_year DESC"
                                                            ],
                                                            "Sort Method": "quicksort",
                                                            "Sort Space Used": 1409,
                                                            "Sort Space Type": "Memory",
                                                            "Shared Hit Blocks": 0,
                                                            "Shared Read Blocks": 0,
                                                            "Shared Dirtied Blocks": 0,
                                                            "Shared Written Blocks": 0,
                                                            "Local Hit Blocks": 0,
                                                            "Local Read Blocks": 0,
                                                            "Local Dirtied Blocks": 0,
                                                            "Local Written Blocks": 0,
                                                            "Temp Read Blocks": 1243,
                                                            "Temp Written Blocks": 0,
                                                            "Plans": [
                                                              {
                                                                "Node Type": "Subquery Scan",
                                                                "Parent Relationship": "Outer",
                                                                "Parallel Aware": false,
                                                                "Async Capable": false,
                                                                "Alias": "a",
                                                                "Startup Cost": 1574.35,
                                                                "Total Cost": 1603.55,
                                                                "Plan Rows": 10,
                                                                "Plan Width": 52,
                                                                "Actual Rows": 14573,
                                                                "Actual Loops": 1,
                                                                "Shared Hit Blocks": 0,
                                                                "Shared Read Blocks": 0,
                                                                "Shared Dirtied Blocks": 0,
                                                                "Shared Written Blocks": 0,
                                                                "Local Hit Blocks": 0,
                                                                "Local Read Blocks": 0,
                                                                "Local Dirtied Blocks": 0,
                                                                "Local Written Blocks": 0,
                                                                "Temp Read Blocks": 1243,
                                                                "Temp Written Blocks": 0,
                                                                "Plans": [
                                                                  {
                                                                    "Node Type": "Aggregate",
                                                                    "Strategy": "Hashed",
                                                                    "Partial Mode": "Simple",
                                                                    "Parent Relationship": "Subquery",
                                                                    "Parallel Aware": false,
                                                                    "Async Capable": false,
                                                                    "Startup Cost": 1574.35,
                                                                    "Total Cost": 1603.45,
                                                                    "Plan Rows": 10,
                                                                    "Plan Width": 60,
                                                                    "Actual Rows": 14573,
                                                                    "Actual Loops": 1,
                                                                    "Group Key": [
                                                                      "r_1.mops_company_id",
                                                                      "r_1.revenue_year"
                                                                    ],
                                                                    "Filter": "(count(*) = 12)",
                                                                    "Planned Partitions": 0,
                                                                    "HashAgg Batches": 1,
                                                                    "Peak Memory Usage": 7697,
                                                                    "Disk Usage": 0,
                                                                    "Rows Removed by Filter": 250,
                                                                    "Shared Hit Blocks": 0,
                                                                    "Shared Read Blocks": 0,
                                                                    "Shared Dirtied Blocks": 0,
                                                                    "Shared Written Blocks": 0,
                                                                    "Local Hit Blocks": 0,
                                                                    "Local Read Blocks": 0,
                                                                    "Local Dirtied Blocks": 0,
                                                                    "Local Written Blocks": 0,
                                                                    "Temp Read Blocks": 1243,
                                                                    "Temp Written Blocks": 0,
                                                                    "Plans": [
                                                                      {
                                                                        "Node Type": "Hash Join",
                                                                        "Parent Relationship": "Outer",
                                                                        "Parallel Aware": false,
                                                                        "Async Capable": false,
                                                                        "Join Type": "Inner",
                                                                        "Startup Cost": 6.5,
                                                                        "Total Cost": 1509.69,
                                                                        "Plan Rows": 6466,
                                                                        "Plan Width": 52,
                                                                        "Actual Rows": 176174,
                                                                        "Actual Loops": 1,
                                                                        "Inner Unique": false,
                                                                        "Hash Cond": "(r_1.mops_company_id = lp_1.mops_company_id)",
                                                                        "Join Filter": "(((r_1.revenue_year)::numeric < EXTRACT(year FROM lp_1.latest_revenue_period)) OR ((EXTRACT(month FROM lp_1.latest_revenue_period) = '12'::numeric) AND ((r_1.revenue_year)::numeric = EXTRACT(year FROM lp_1.latest_revenue_period))))",
                                                                        "Rows Removed by Join Filter": 17764,
                                                                        "Shared Hit Blocks": 0,
                                                                        "Shared Read Blocks": 0,
                                                                        "Shared Dirtied Blocks": 0,
                                                                        "Shared Written Blocks": 0,
                                                                        "Local Hit Blocks": 0,
                                                                        "Local Read Blocks": 0,
                                                                        "Local Dirtied Blocks": 0,
                                                                        "Local Written Blocks": 0,
                                                                        "Temp Read Blocks": 1243,
                                                                        "Temp Written Blocks": 0,
                                                                        "Plans": [
                                                                          {
                                                                            "Node Type": "CTE Scan",
                                                                            "Parent Relationship": "Outer",
                                                                            "Parallel Aware": false,
                                                                            "Async Capable": false,
                                                                            "CTE Name": "canonical_revenue",
                                                                            "Alias": "r_1",
                                                                            "Startup Cost": 0.0,
                                                                            "Total Cost": 387.92,
                                                                            "Plan Rows": 19396,
                                                                            "Plan Width": 52,
                                                                            "Actual Rows": 193938,
                                                                            "Actual Loops": 1,
                                                                            "Shared Hit Blocks": 0,
                                                                            "Shared Read Blocks": 0,
                                                                            "Shared Dirtied Blocks": 0,
                                                                            "Shared Written Blocks": 0,
                                                                            "Local Hit Blocks": 0,
                                                                            "Local Read Blocks": 0,
                                                                            "Local Dirtied Blocks": 0,
                                                                            "Local Written Blocks": 0,
                                                                            "Temp Read Blocks": 1243,
                                                                            "Temp Written Blocks": 0
                                                                          },
                                                                          {
                                                                            "Node Type": "Hash",
                                                                            "Parent Relationship": "Inner",
                                                                            "Parallel Aware": false,
                                                                            "Async Capable": false,
                                                                            "Startup Cost": 4.0,
                                                                            "Total Cost": 4.0,
                                                                            "Plan Rows": 200,
                                                                            "Plan Width": 20,
                                                                            "Actual Rows": 1987,
                                                                            "Actual Loops": 1,
                                                                            "Hash Buckets": 2048,
                                                                            "Original Hash Buckets": 1024,
                                                                            "Hash Batches": 1,
                                                                            "Original Hash Batches": 1,
                                                                            "Peak Memory Usage": 117,
                                                                            "Shared Hit Blocks": 0,
                                                                            "Shared Read Blocks": 0,
                                                                            "Shared Dirtied Blocks": 0,
                                                                            "Shared Written Blocks": 0,
                                                                            "Local Hit Blocks": 0,
                                                                            "Local Read Blocks": 0,
                                                                            "Local Dirtied Blocks": 0,
                                                                            "Local Written Blocks": 0,
                                                                            "Temp Read Blocks": 0,
                                                                            "Temp Written Blocks": 0,
                                                                            "Plans": [
                                                                              {
                                                                                "Node Type": "CTE Scan",
                                                                                "Parent Relationship": "Outer",
                                                                                "Parallel Aware": false,
                                                                                "Async Capable": false,
                                                                                "CTE Name": "latest_period",
                                                                                "Alias": "lp_1",
                                                                                "Startup Cost": 0.0,
                                                                                "Total Cost": 4.0,
                                                                                "Plan Rows": 200,
                                                                                "Plan Width": 20,
                                                                                "Actual Rows": 1987,
                                                                                "Actual Loops": 1,
                                                                                "Shared Hit Blocks": 0,
                                                                                "Shared Read Blocks": 0,
                                                                                "Shared Dirtied Blocks": 0,
                                                                                "Shared Written Blocks": 0,
                                                                                "Local Hit Blocks": 0,
                                                                                "Local Read Blocks": 0,
                                                                                "Local Dirtied Blocks": 0,
                                                                                "Local Written Blocks": 0,
                                                                                "Temp Read Blocks": 0,
                                                                                "Temp Written Blocks": 0
                                                                              }
                                                                            ]
                                                                          }
                                                                        ]
                                                                      }
                                                                    ]
                                                                  }
                                                                ]
                                                              }
                                                            ]
                                                          }
                                                        ]
                                                      }
                                                    ]
                                                  }
                                                ]
                                              },
                                              {
                                                "Node Type": "Index Scan",
                                                "Parent Relationship": "Inner",
                                                "Parallel Aware": false,
                                                "Async Capable": false,
                                                "Scan Direction": "Forward",
                                                "Index Name": "mops_company_pkey",
                                                "Relation Name": "mops_company",
                                                "Alias": "c",
                                                "Startup Cost": 0.28,
                                                "Total Cost": 8.3,
                                                "Plan Rows": 1,
                                                "Plan Width": 62,
                                                "Actual Rows": 1,
                                                "Actual Loops": 137,
                                                "Index Cond": "(id = lp.mops_company_id)",
                                                "Rows Removed by Index Recheck": 0,
                                                "Filter": "(is_active AND (market = 'TWSE'::mops_market))",
                                                "Rows Removed by Filter": 0,
                                                "Shared Hit Blocks": 374,
                                                "Shared Read Blocks": 37,
                                                "Shared Dirtied Blocks": 0,
                                                "Shared Written Blocks": 0,
                                                "Local Hit Blocks": 0,
                                                "Local Read Blocks": 0,
                                                "Local Dirtied Blocks": 0,
                                                "Local Written Blocks": 0,
                                                "Temp Read Blocks": 0,
                                                "Temp Written Blocks": 0
                                              }
                                            ]
                                          },
                                          {
                                            "Node Type": "Index Scan",
                                            "Parent Relationship": "Inner",
                                            "Parallel Aware": false,
                                            "Async Capable": false,
                                            "Scan Direction": "Forward",
                                            "Index Name": "market_instrument_entity_status_idx",
                                            "Relation Name": "market_instrument",
                                            "Alias": "instrument",
                                            "Startup Cost": 0.29,
                                            "Total Cost": 3.27,
                                            "Plan Rows": 1,
                                            "Plan Width": 53,
                                            "Actual Rows": 1,
                                            "Actual Loops": 73,
                                            "Index Cond": "((entity_id = c.direct_entity_id) AND (status = 'ACTIVE'::text))",
                                            "Rows Removed by Index Recheck": 0,
                                            "Filter": "((instrument_kind = 'EQUITY'::text) AND (quote_asset_code = 'TWD'::text) AND (c.mops_code = symbol))",
                                            "Rows Removed by Filter": 0,
                                            "Shared Hit Blocks": 144,
                                            "Shared Read Blocks": 76,
                                            "Shared Dirtied Blocks": 0,
                                            "Shared Written Blocks": 0,
                                            "Local Hit Blocks": 0,
                                            "Local Read Blocks": 0,
                                            "Local Dirtied Blocks": 0,
                                            "Local Written Blocks": 0,
                                            "Temp Read Blocks": 0,
                                            "Temp Written Blocks": 0
                                          }
                                        ]
                                      },
                                      {
                                        "Node Type": "Seq Scan",
                                        "Parent Relationship": "Inner",
                                        "Parallel Aware": false,
                                        "Async Capable": false,
                                        "Relation Name": "market_venue",
                                        "Alias": "venue",
                                        "Startup Cost": 0.0,
                                        "Total Cost": 1.06,
                                        "Plan Rows": 1,
                                        "Plan Width": 16,
                                        "Actual Rows": 1,
                                        "Actual Loops": 73,
                                        "Filter": "(code = 'XTAI'::text)",
                                        "Rows Removed by Filter": 3,
                                        "Shared Hit Blocks": 73,
                                        "Shared Read Blocks": 0,
                                        "Shared Dirtied Blocks": 0,
                                        "Shared Written Blocks": 0,
                                        "Local Hit Blocks": 0,
                                        "Local Read Blocks": 0,
                                        "Local Dirtied Blocks": 0,
                                        "Local Written Blocks": 0,
                                        "Temp Read Blocks": 0,
                                        "Temp Written Blocks": 0
                                      }
                                    ]
                                  },
                                  {
                                    "Node Type": "Seq Scan",
                                    "Parent Relationship": "Inner",
                                    "Parallel Aware": false,
                                    "Async Capable": false,
                                    "Relation Name": "market_data_source",
                                    "Alias": "source",
                                    "Startup Cost": 0.0,
                                    "Total Cost": 1.09,
                                    "Plan Rows": 1,
                                    "Plan Width": 16,
                                    "Actual Rows": 1,
                                    "Actual Loops": 73,
                                    "Filter": "(is_active AND (code = 'TWSE'::text))",
                                    "Rows Removed by Filter": 6,
                                    "Shared Hit Blocks": 73,
                                    "Shared Read Blocks": 0,
                                    "Shared Dirtied Blocks": 0,
                                    "Shared Written Blocks": 0,
                                    "Local Hit Blocks": 0,
                                    "Local Read Blocks": 0,
                                    "Local Dirtied Blocks": 0,
                                    "Local Written Blocks": 0,
                                    "Temp Read Blocks": 0,
                                    "Temp Written Blocks": 0
                                  }
                                ]
                              },
                              {
                                "Node Type": "Index Scan",
                                "Parent Relationship": "Inner",
                                "Parallel Aware": false,
                                "Async Capable": false,
                                "Scan Direction": "Forward",
                                "Index Name": "market_equity_snapshot_pk",
                                "Relation Name": "market_equity_snapshot",
                                "Alias": "snapshot",
                                "Startup Cost": 0.28,
                                "Total Cost": 3.01,
                                "Plan Rows": 1,
                                "Plan Width": 51,
                                "Actual Rows": 1,
                                "Actual Loops": 73,
                                "Index Cond": "(instrument_id = instrument.id)",
                                "Rows Removed by Index Recheck": 0,
                                "Filter": "((market_capitalization > '0'::numeric) AND (market_capitalization >= '20000000000'::numeric) AND (('2026-11-02'::date - session_date) <= 14))",
                                "Rows Removed by Filter": 0,
                                "Shared Hit Blocks": 139,
                                "Shared Read Blocks": 80,
                                "Shared Dirtied Blocks": 0,
                                "Shared Written Blocks": 0,
                                "Local Hit Blocks": 0,
                                "Local Read Blocks": 0,
                                "Local Dirtied Blocks": 0,
                                "Local Written Blocks": 0,
                                "Temp Read Blocks": 0,
                                "Temp Written Blocks": 0
                              }
                            ]
                          },
                          {
                            "Node Type": "Index Scan",
                            "Parent Relationship": "Inner",
                            "Parallel Aware": false,
                            "Async Capable": false,
                            "Scan Direction": "Forward",
                            "Index Name": "market_candle_series_instrument_active_idx",
                            "Relation Name": "market_candle_series",
                            "Alias": "series",
                            "Startup Cost": 0.29,
                            "Total Cost": 4.6,
                            "Plan Rows": 1,
                            "Plan Width": 48,
                            "Actual Rows": 1,
                            "Actual Loops": 51,
                            "Index Cond": "((instrument_id = instrument.id) AND (bar_interval = '1d'::text) AND (is_active = true))",
                            "Rows Removed by Index Recheck": 0,
                            "Filter": "((session_scope = 'ALL'::text) AND (price_basis = 'RAW'::text))",
                            "Rows Removed by Filter": 0,
                            "Shared Hit Blocks": 75,
                            "Shared Read Blocks": 79,
                            "Shared Dirtied Blocks": 0,
                            "Shared Written Blocks": 0,
                            "Local Hit Blocks": 0,
                            "Local Read Blocks": 0,
                            "Local Dirtied Blocks": 0,
                            "Local Written Blocks": 0,
                            "Temp Read Blocks": 0,
                            "Temp Written Blocks": 0
                          }
                        ]
                      },
                      {
                        "Node Type": "Bitmap Heap Scan",
                        "Parent Relationship": "Inner",
                        "Parallel Aware": false,
                        "Async Capable": false,
                        "Relation Name": "market_candle",
                        "Alias": "candle",
                        "Startup Cost": 59.96,
                        "Total Cost": 3459.73,
                        "Plan Rows": 2233,
                        "Plan Width": 28,
                        "Actual Rows": 3433,
                        "Actual Loops": 51,
                        "Recheck Cond": "((series_id = series.id) AND (superseded_at IS NULL))",
                        "Rows Removed by Index Recheck": 0,
                        "Exact Heap Blocks": 14112,
                        "Lossy Heap Blocks": 0,
                        "Shared Hit Blocks": 2603,
                        "Shared Read Blocks": 12574,
                        "Shared Dirtied Blocks": 0,
                        "Shared Written Blocks": 0,
                        "Local Hit Blocks": 0,
                        "Local Read Blocks": 0,
                        "Local Dirtied Blocks": 0,
                        "Local Written Blocks": 0,
                        "Temp Read Blocks": 0,
                        "Temp Written Blocks": 0,
                        "Plans": [
                          {
                            "Node Type": "Bitmap Index Scan",
                            "Parent Relationship": "Outer",
                            "Parallel Aware": false,
                            "Async Capable": false,
                            "Index Name": "market_candle_current_identity_idx",
                            "Startup Cost": 0.0,
                            "Total Cost": 59.41,
                            "Plan Rows": 2233,
                            "Plan Width": 0,
                            "Actual Rows": 3433,
                            "Actual Loops": 51,
                            "Index Cond": "(series_id = series.id)",
                            "Shared Hit Blocks": 101,
                            "Shared Read Blocks": 964,
                            "Shared Dirtied Blocks": 0,
                            "Shared Written Blocks": 0,
                            "Local Hit Blocks": 0,
                            "Local Read Blocks": 0,
                            "Local Dirtied Blocks": 0,
                            "Local Written Blocks": 0,
                            "Temp Read Blocks": 0,
                            "Temp Written Blocks": 0
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  "Settings": {},
  "Planning": {
    "Shared Hit Blocks": 891,
    "Shared Read Blocks": 88,
    "Shared Dirtied Blocks": 0,
    "Shared Written Blocks": 0,
    "Local Hit Blocks": 0,
    "Local Read Blocks": 0,
    "Local Dirtied Blocks": 0,
    "Local Written Blocks": 0,
    "Temp Read Blocks": 0,
    "Temp Written Blocks": 0
  },
  "Planning Time": 43.25,
  "Triggers": [],
  "Execution Time": 5159.009
}