@memberjunction/db-auto-doc 6.2.0-edge.2 → 6.2.0-edge.4
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/README.md +105 -3
- package/dist/commands/export.d.ts +8 -0
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +53 -2
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/core/AnalysisOrchestrator.d.ts +5 -0
- package/dist/core/AnalysisOrchestrator.d.ts.map +1 -1
- package/dist/core/AnalysisOrchestrator.js +32 -0
- package/dist/core/AnalysisOrchestrator.js.map +1 -1
- package/dist/drivers/BaseAutoDocDriver.d.ts +6 -1
- package/dist/drivers/BaseAutoDocDriver.d.ts.map +1 -1
- package/dist/drivers/BaseAutoDocDriver.js.map +1 -1
- package/dist/drivers/IndexCatalog.d.ts +54 -0
- package/dist/drivers/IndexCatalog.d.ts.map +1 -0
- package/dist/drivers/IndexCatalog.js +145 -0
- package/dist/drivers/IndexCatalog.js.map +1 -0
- package/dist/drivers/MySQLDriver.d.ts +5 -1
- package/dist/drivers/MySQLDriver.d.ts.map +1 -1
- package/dist/drivers/MySQLDriver.js +15 -6
- package/dist/drivers/MySQLDriver.js.map +1 -1
- package/dist/drivers/PostgreSQLDriver.d.ts +5 -1
- package/dist/drivers/PostgreSQLDriver.d.ts.map +1 -1
- package/dist/drivers/PostgreSQLDriver.js +11 -0
- package/dist/drivers/PostgreSQLDriver.js.map +1 -1
- package/dist/drivers/SQLServerDriver.d.ts +5 -1
- package/dist/drivers/SQLServerDriver.d.ts.map +1 -1
- package/dist/drivers/SQLServerDriver.js +11 -0
- package/dist/drivers/SQLServerDriver.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/plugins/BaseAutoDocPlugin.d.ts +33 -0
- package/dist/plugins/BaseAutoDocPlugin.d.ts.map +1 -0
- package/dist/plugins/BaseAutoDocPlugin.js +70 -0
- package/dist/plugins/BaseAutoDocPlugin.js.map +1 -0
- package/dist/plugins/PluginManager.d.ts +54 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -0
- package/dist/plugins/PluginManager.js +115 -0
- package/dist/plugins/PluginManager.js.map +1 -0
- package/dist/plugins/builtins.d.ts +13 -0
- package/dist/plugins/builtins.d.ts.map +1 -0
- package/dist/plugins/builtins.js +12 -0
- package/dist/plugins/builtins.js.map +1 -0
- package/dist/plugins/index-advisor/IndexAdvisorPlugin.d.ts +25 -0
- package/dist/plugins/index-advisor/IndexAdvisorPlugin.d.ts.map +1 -0
- package/dist/plugins/index-advisor/IndexAdvisorPlugin.js +128 -0
- package/dist/plugins/index-advisor/IndexAdvisorPlugin.js.map +1 -0
- package/dist/plugins/index-advisor/IndexAdvisorTypes.d.ts +111 -0
- package/dist/plugins/index-advisor/IndexAdvisorTypes.d.ts.map +1 -0
- package/dist/plugins/index-advisor/IndexAdvisorTypes.js +5 -0
- package/dist/plugins/index-advisor/IndexAdvisorTypes.js.map +1 -0
- package/dist/plugins/index-advisor/IndexLLMReview.d.ts +48 -0
- package/dist/plugins/index-advisor/IndexLLMReview.d.ts.map +1 -0
- package/dist/plugins/index-advisor/IndexLLMReview.js +181 -0
- package/dist/plugins/index-advisor/IndexLLMReview.js.map +1 -0
- package/dist/plugins/index-advisor/IndexMigrationGenerator.d.ts +28 -0
- package/dist/plugins/index-advisor/IndexMigrationGenerator.d.ts.map +1 -0
- package/dist/plugins/index-advisor/IndexMigrationGenerator.js +98 -0
- package/dist/plugins/index-advisor/IndexMigrationGenerator.js.map +1 -0
- package/dist/plugins/index-advisor/IndexRules.d.ts +19 -0
- package/dist/plugins/index-advisor/IndexRules.d.ts.map +1 -0
- package/dist/plugins/index-advisor/IndexRules.js +154 -0
- package/dist/plugins/index-advisor/IndexRules.js.map +1 -0
- package/dist/plugins/index.d.ts +13 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +13 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/types.d.ts +82 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +9 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/types/config.d.ts +6 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +0 -3
- package/dist/types/config.js.map +1 -1
- package/dist/types/driver.d.ts +30 -0
- package/dist/types/driver.d.ts.map +1 -1
- package/dist/types/driver.js +5 -1
- package/dist/types/driver.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/state.d.ts +9 -0
- package/dist/types/state.d.ts.map +1 -1
- package/dist/utils/config-loader.js +1 -1
- package/dist/utils/config-loader.js.map +1 -1
- package/package.json +5 -5
- package/prompts/index-review.md +60 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
You are a database performance expert reviewing index recommendations for one table on {{ platform }}.
|
|
2
|
+
|
|
3
|
+
## Table: {{ table.schema }}.{{ table.name }} ({{ table.rowCount }} rows)
|
|
4
|
+
{% if table.description %}**Description**: {{ table.description }}{% endif %}
|
|
5
|
+
|
|
6
|
+
## Columns
|
|
7
|
+
{% for c in columns %}
|
|
8
|
+
- **{{ c.name }}** {{ c.dataType }}{% if c.distinctCount != null %}, {{ c.distinctCount }} distinct{% endif %}{% if c.nullPercentage != null %}, {{ c.nullPercentage }}% null{% endif %}{% if c.description %} — {{ c.description }}{% endif %}
|
|
9
|
+
{% endfor %}
|
|
10
|
+
|
|
11
|
+
## Existing indexes
|
|
12
|
+
{% if existing.length %}{% for ix in existing %}
|
|
13
|
+
- {{ ix.name }} ({{ ix.columns | join(", ") }}){% if ix.include.length %} INCLUDE ({{ ix.include | join(", ") }}){% endif %}{% if ix.isPrimaryKey %} [primary key]{% elif ix.isUnique %} [unique]{% endif %}{% if ix.filter %} WHERE {{ ix.filter }}{% endif %}
|
|
14
|
+
{% endfor %}{% else %}
|
|
15
|
+
(none)
|
|
16
|
+
{% endif %}
|
|
17
|
+
|
|
18
|
+
## Proposed indexes (from deterministic rules)
|
|
19
|
+
{% if proposals.length %}{% for p in proposals %}
|
|
20
|
+
{{ loop.index }}. ({{ p.columns | join(", ") }}) — {{ p.reason }}
|
|
21
|
+
{% endfor %}{% else %}
|
|
22
|
+
(none)
|
|
23
|
+
{% endif %}
|
|
24
|
+
|
|
25
|
+
{% if sampleQueries.length %}## Queries that use this table
|
|
26
|
+
{% for q in sampleQueries %}
|
|
27
|
+
### {{ q.name }}
|
|
28
|
+
```sql
|
|
29
|
+
{{ q.sql }}
|
|
30
|
+
```
|
|
31
|
+
{% endfor %}{% endif %}
|
|
32
|
+
|
|
33
|
+
## Your task
|
|
34
|
+
|
|
35
|
+
1. For each proposed index, decide **keep**, **drop** (not worth it: e.g. the column is rarely used to join or filter, or another index does the job) or **modify** (better as a composite index, or with INCLUDE columns that make it covering for the queries above).
|
|
36
|
+
2. Suggest **additional** indexes only when there is clear evidence: columns the queries above filter, join, group or sort on, or obvious lookup columns (codes, emails, external IDs) on a large table. Prefer few, high-value indexes; every index slows writes.
|
|
37
|
+
|
|
38
|
+
Rules:
|
|
39
|
+
- Use only column names listed above, spelled exactly.
|
|
40
|
+
- Put the most selective / equality-filtered column first in a composite index.
|
|
41
|
+
- Do not suggest an index that an existing index already starts with.
|
|
42
|
+
- Do not lead an index with a column that has very few distinct values or a large text/JSON type.
|
|
43
|
+
- At most 5 key columns per index.
|
|
44
|
+
|
|
45
|
+
## Response format
|
|
46
|
+
|
|
47
|
+
Return only JSON, exactly in this shape (use empty arrays when you have nothing):
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"Decisions": [
|
|
52
|
+
{ "Proposal": 1, "Action": "keep", "Reason": "…" },
|
|
53
|
+
{ "Proposal": 2, "Action": "modify", "Columns": ["ColA", "ColB"], "IncludeColumns": ["ColC"], "Reason": "…" },
|
|
54
|
+
{ "Proposal": 3, "Action": "drop", "Reason": "…" }
|
|
55
|
+
],
|
|
56
|
+
"Additions": [
|
|
57
|
+
{ "Columns": ["ColX"], "IncludeColumns": [], "Reason": "…" }
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
```
|