@mastra/pg 0.17.1 → 0.17.2-alpha.0
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/pg
|
|
2
2
|
|
|
3
|
+
## 0.17.2-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add validation for index creation ([#8552](https://github.com/mastra-ai/mastra/pull/8552))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`c621613`](https://github.com/mastra-ai/mastra/commit/c621613069173c69eb2c3ef19a5308894c6549f0), [`12b1189`](https://github.com/mastra-ai/mastra/commit/12b118942445e4de0dd916c593e33ec78dc3bc73), [`4783b30`](https://github.com/mastra-ai/mastra/commit/4783b3063efea887825514b783ba27f67912c26d), [`076b092`](https://github.com/mastra-ai/mastra/commit/076b0924902ff0f49d5712d2df24c4cca683713f), [`2aee9e7`](https://github.com/mastra-ai/mastra/commit/2aee9e7d188b8b256a4ddc203ccefb366b4867fa), [`c582906`](https://github.com/mastra-ai/mastra/commit/c5829065a346260f96c4beb8af131b94804ae3ad), [`fa2eb96`](https://github.com/mastra-ai/mastra/commit/fa2eb96af16c7d433891a73932764960d3235c1d), [`4783b30`](https://github.com/mastra-ai/mastra/commit/4783b3063efea887825514b783ba27f67912c26d), [`a739d0c`](https://github.com/mastra-ai/mastra/commit/a739d0c8b37cd89569e04a6ca0827083c6167e19), [`603e927`](https://github.com/mastra-ai/mastra/commit/603e9279db8bf8a46caf83881c6b7389ccffff7e), [`cd45982`](https://github.com/mastra-ai/mastra/commit/cd4598291cda128a88738734ae6cbef076ebdebd), [`874f74d`](https://github.com/mastra-ai/mastra/commit/874f74da4b1acf6517f18132d035612c3ecc394a), [`0baf2ba`](https://github.com/mastra-ai/mastra/commit/0baf2bab8420277072ef1f95df5ea7b0a2f61fe7), [`26e968d`](https://github.com/mastra-ai/mastra/commit/26e968db2171ded9e4d47aa1b4f19e1e771158d0), [`cbd3fb6`](https://github.com/mastra-ai/mastra/commit/cbd3fb65adb03a7c0df193cb998aed5ac56675ee)]:
|
|
10
|
+
- @mastra/core@0.20.1-alpha.1
|
|
11
|
+
|
|
3
12
|
## 0.17.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -3132,65 +3132,72 @@ var StoreOperationsPG = class extends storage.StoreOperations {
|
|
|
3132
3132
|
}
|
|
3133
3133
|
}
|
|
3134
3134
|
/**
|
|
3135
|
-
*
|
|
3135
|
+
* Returns definitions for automatic performance indexes
|
|
3136
3136
|
* These composite indexes cover both filtering and sorting in single index
|
|
3137
3137
|
*/
|
|
3138
|
+
getAutomaticIndexDefinitions() {
|
|
3139
|
+
const schemaPrefix = this.schemaName ? `${this.schemaName}_` : "";
|
|
3140
|
+
return [
|
|
3141
|
+
// Composite index for threads (filter + sort)
|
|
3142
|
+
{
|
|
3143
|
+
name: `${schemaPrefix}mastra_threads_resourceid_createdat_idx`,
|
|
3144
|
+
table: storage.TABLE_THREADS,
|
|
3145
|
+
columns: ["resourceId", "createdAt DESC"]
|
|
3146
|
+
},
|
|
3147
|
+
// Composite index for messages (filter + sort)
|
|
3148
|
+
{
|
|
3149
|
+
name: `${schemaPrefix}mastra_messages_thread_id_createdat_idx`,
|
|
3150
|
+
table: storage.TABLE_MESSAGES,
|
|
3151
|
+
columns: ["thread_id", "createdAt DESC"]
|
|
3152
|
+
},
|
|
3153
|
+
// Composite index for traces (filter + sort)
|
|
3154
|
+
{
|
|
3155
|
+
name: `${schemaPrefix}mastra_traces_name_starttime_idx`,
|
|
3156
|
+
table: storage.TABLE_TRACES,
|
|
3157
|
+
columns: ["name", "startTime DESC"]
|
|
3158
|
+
},
|
|
3159
|
+
// Composite index for evals (filter + sort)
|
|
3160
|
+
{
|
|
3161
|
+
name: `${schemaPrefix}mastra_evals_agent_name_created_at_idx`,
|
|
3162
|
+
table: storage.TABLE_EVALS,
|
|
3163
|
+
columns: ["agent_name", "created_at DESC"]
|
|
3164
|
+
},
|
|
3165
|
+
// Composite index for scores (filter + sort)
|
|
3166
|
+
{
|
|
3167
|
+
name: `${schemaPrefix}mastra_scores_trace_id_span_id_created_at_idx`,
|
|
3168
|
+
table: storage.TABLE_SCORERS,
|
|
3169
|
+
columns: ["traceId", "spanId", "createdAt DESC"]
|
|
3170
|
+
},
|
|
3171
|
+
// AI Spans indexes for optimal trace querying
|
|
3172
|
+
{
|
|
3173
|
+
name: `${schemaPrefix}mastra_ai_spans_traceid_startedat_idx`,
|
|
3174
|
+
table: storage.TABLE_AI_SPANS,
|
|
3175
|
+
columns: ["traceId", "startedAt DESC"]
|
|
3176
|
+
},
|
|
3177
|
+
{
|
|
3178
|
+
name: `${schemaPrefix}mastra_ai_spans_parentspanid_startedat_idx`,
|
|
3179
|
+
table: storage.TABLE_AI_SPANS,
|
|
3180
|
+
columns: ["parentSpanId", "startedAt DESC"]
|
|
3181
|
+
},
|
|
3182
|
+
{
|
|
3183
|
+
name: `${schemaPrefix}mastra_ai_spans_name_idx`,
|
|
3184
|
+
table: storage.TABLE_AI_SPANS,
|
|
3185
|
+
columns: ["name"]
|
|
3186
|
+
},
|
|
3187
|
+
{
|
|
3188
|
+
name: `${schemaPrefix}mastra_ai_spans_spantype_startedat_idx`,
|
|
3189
|
+
table: storage.TABLE_AI_SPANS,
|
|
3190
|
+
columns: ["spanType", "startedAt DESC"]
|
|
3191
|
+
}
|
|
3192
|
+
];
|
|
3193
|
+
}
|
|
3194
|
+
/**
|
|
3195
|
+
* Creates automatic indexes for optimal query performance
|
|
3196
|
+
* Uses getAutomaticIndexDefinitions() to determine which indexes to create
|
|
3197
|
+
*/
|
|
3138
3198
|
async createAutomaticIndexes() {
|
|
3139
3199
|
try {
|
|
3140
|
-
const
|
|
3141
|
-
const indexes = [
|
|
3142
|
-
// Composite index for threads (filter + sort)
|
|
3143
|
-
{
|
|
3144
|
-
name: `${schemaPrefix}mastra_threads_resourceid_createdat_idx`,
|
|
3145
|
-
table: storage.TABLE_THREADS,
|
|
3146
|
-
columns: ["resourceId", "createdAt DESC"]
|
|
3147
|
-
},
|
|
3148
|
-
// Composite index for messages (filter + sort)
|
|
3149
|
-
{
|
|
3150
|
-
name: `${schemaPrefix}mastra_messages_thread_id_createdat_idx`,
|
|
3151
|
-
table: storage.TABLE_MESSAGES,
|
|
3152
|
-
columns: ["thread_id", "createdAt DESC"]
|
|
3153
|
-
},
|
|
3154
|
-
// Composite index for traces (filter + sort)
|
|
3155
|
-
{
|
|
3156
|
-
name: `${schemaPrefix}mastra_traces_name_starttime_idx`,
|
|
3157
|
-
table: storage.TABLE_TRACES,
|
|
3158
|
-
columns: ["name", "startTime DESC"]
|
|
3159
|
-
},
|
|
3160
|
-
// Composite index for evals (filter + sort)
|
|
3161
|
-
{
|
|
3162
|
-
name: `${schemaPrefix}mastra_evals_agent_name_created_at_idx`,
|
|
3163
|
-
table: storage.TABLE_EVALS,
|
|
3164
|
-
columns: ["agent_name", "created_at DESC"]
|
|
3165
|
-
},
|
|
3166
|
-
// Composite index for scores (filter + sort)
|
|
3167
|
-
{
|
|
3168
|
-
name: `${schemaPrefix}mastra_scores_trace_id_span_id_created_at_idx`,
|
|
3169
|
-
table: storage.TABLE_SCORERS,
|
|
3170
|
-
columns: ["trace_id", "span_id", "created_at DESC"]
|
|
3171
|
-
},
|
|
3172
|
-
// AI Spans indexes for optimal trace querying
|
|
3173
|
-
{
|
|
3174
|
-
name: `${schemaPrefix}mastra_ai_spans_traceid_startedat_idx`,
|
|
3175
|
-
table: storage.TABLE_AI_SPANS,
|
|
3176
|
-
columns: ["traceId", "startedAt DESC"]
|
|
3177
|
-
},
|
|
3178
|
-
{
|
|
3179
|
-
name: `${schemaPrefix}mastra_ai_spans_parentspanid_startedat_idx`,
|
|
3180
|
-
table: storage.TABLE_AI_SPANS,
|
|
3181
|
-
columns: ["parentSpanId", "startedAt DESC"]
|
|
3182
|
-
},
|
|
3183
|
-
{
|
|
3184
|
-
name: `${schemaPrefix}mastra_ai_spans_name_idx`,
|
|
3185
|
-
table: storage.TABLE_AI_SPANS,
|
|
3186
|
-
columns: ["name"]
|
|
3187
|
-
},
|
|
3188
|
-
{
|
|
3189
|
-
name: `${schemaPrefix}mastra_ai_spans_spantype_startedat_idx`,
|
|
3190
|
-
table: storage.TABLE_AI_SPANS,
|
|
3191
|
-
columns: ["spanType", "startedAt DESC"]
|
|
3192
|
-
}
|
|
3193
|
-
];
|
|
3200
|
+
const indexes = this.getAutomaticIndexDefinitions();
|
|
3194
3201
|
for (const indexOptions of indexes) {
|
|
3195
3202
|
try {
|
|
3196
3203
|
await this.createIndex(indexOptions);
|