agrs-sequelize-sdk 1.4.41 → 1.4.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -285,6 +285,37 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
285
285
|
{ fields: ["vertical", "feed_provider"] },
|
|
286
286
|
{ fields: ["details"], using: "gin" },
|
|
287
287
|
{ fields: ["platform_code"] },
|
|
288
|
+
// Partial indexes for the hourly Tarzo reconciler (steps 2/5 and 3/5
|
|
289
|
+
// in reconcilerService.js). Both steps filter on:
|
|
290
|
+
// status='IN_PROGRESS'
|
|
291
|
+
// AND details->>'ai_stage'='tarzo_awaiting_materialization'
|
|
292
|
+
// Predicate is equality — NOT `LIKE 'tarzo_%'` — because Postgres's
|
|
293
|
+
// partial-index prover doesn't cross equality→LIKE, so a LIKE-predicate
|
|
294
|
+
// index would be ignored (verified in prod 2026-07-19). Equality
|
|
295
|
+
// matches the queries verbatim, so the planner picks these up.
|
|
296
|
+
//
|
|
297
|
+
// Column choices:
|
|
298
|
+
// - feed_campaign_id: drives the nested-loop join to
|
|
299
|
+
// rsoc_feed_campaigns.AGRS_CID in step 2/5.
|
|
300
|
+
// - created_at: powers the stale age filter in step 3/5.
|
|
301
|
+
//
|
|
302
|
+
// Self-pruning: rows leave the index as soon as status flips to
|
|
303
|
+
// COMPLETED/FAILED, so index size stays proportional to in-flight
|
|
304
|
+
// rows only.
|
|
305
|
+
{
|
|
306
|
+
name: "idx_v2_awaiting_by_feed_campaign",
|
|
307
|
+
fields: ["feed_campaign_id"],
|
|
308
|
+
where: sequelize.literal(
|
|
309
|
+
`status = 'IN_PROGRESS' AND (details->>'ai_stage') = 'tarzo_awaiting_materialization'`
|
|
310
|
+
),
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: "idx_v2_awaiting_created_at",
|
|
314
|
+
fields: [{ name: "created_at", order: "DESC" }],
|
|
315
|
+
where: sequelize.literal(
|
|
316
|
+
`status = 'IN_PROGRESS' AND (details->>'ai_stage') = 'tarzo_awaiting_materialization'`
|
|
317
|
+
),
|
|
318
|
+
},
|
|
288
319
|
],
|
|
289
320
|
}
|
|
290
321
|
);
|