orangeslice 1.7.2 → 1.7.3
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/docs/b2b-docs/B2B_CROSS_TABLE_TEST_FINDINGS.md +255 -0
- package/docs/b2b-docs/B2B_DATABASE.md +314 -0
- package/docs/b2b-docs/B2B_DATABASE_TEST_FINDINGS.md +476 -0
- package/docs/b2b-docs/B2B_EMPLOYEE_SEARCH.md +697 -0
- package/docs/b2b-docs/B2B_GENERALIZATION_RULES.md +220 -0
- package/docs/b2b-docs/B2B_NLP_QUERY_MAPPINGS.md +240 -0
- package/docs/b2b-docs/B2B_NORMALIZED_VS_DENORMALIZED.md +952 -0
- package/docs/b2b-docs/B2B_SCHEMA.md +1042 -0
- package/docs/b2b-docs/B2B_SQL_COMPREHENSIVE_TEST_FINDINGS.md +301 -0
- package/docs/b2b-docs/B2B_TABLE_INDICES.ts +496 -0
- package/package.json +1 -1
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* B2B Database Table Index Mapping
|
|
3
|
+
* Generated from docs/B2B_SCHEMA.md
|
|
4
|
+
*
|
|
5
|
+
* Maps each table to its available indices for query optimization.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface TableIndex {
|
|
9
|
+
name: string;
|
|
10
|
+
type: "UNIQUE btree" | "btree" | "GIN" | "GiST";
|
|
11
|
+
columns: string[];
|
|
12
|
+
notes?: string;
|
|
13
|
+
isPartial?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface TableIndexMapping {
|
|
17
|
+
table: string;
|
|
18
|
+
recordCount?: string;
|
|
19
|
+
indices: TableIndex[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const B2B_TABLE_INDICES: TableIndexMapping[] = [
|
|
23
|
+
// ===================
|
|
24
|
+
// CORE TABLES
|
|
25
|
+
// ===================
|
|
26
|
+
{
|
|
27
|
+
table: "linkedin_company",
|
|
28
|
+
recordCount: "~millions",
|
|
29
|
+
indices: [
|
|
30
|
+
{ name: "linkedin_company_pkey", type: "UNIQUE btree", columns: ["id"], notes: "Primary key" },
|
|
31
|
+
{
|
|
32
|
+
name: "linkedin_company_universal_name_ix",
|
|
33
|
+
type: "btree",
|
|
34
|
+
columns: ["universal_name"],
|
|
35
|
+
notes: "Fast lookup"
|
|
36
|
+
},
|
|
37
|
+
{ name: "ix_linkedin_company_domain", type: "btree", columns: ["domain"], notes: "Fast lookup" },
|
|
38
|
+
{ name: "ix_linkedin_company_company_id", type: "btree", columns: ["company_id"], notes: "FK lookup" },
|
|
39
|
+
{ name: "ix_linkedin_company_ticker", type: "btree", columns: ["ticker"], notes: "Stock lookup" },
|
|
40
|
+
{
|
|
41
|
+
name: "ix_linkedin_company_tsv",
|
|
42
|
+
type: "GIN",
|
|
43
|
+
columns: ["company_name", "universal_name"],
|
|
44
|
+
notes: "Full-text search"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "ix_linkedin_company_linkedin_org_id",
|
|
48
|
+
type: "btree",
|
|
49
|
+
columns: ["linkedin_org_id"],
|
|
50
|
+
notes: "Partial (NOT NULL)",
|
|
51
|
+
isPartial: true
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
table: "linkedin_profile",
|
|
57
|
+
recordCount: "~1.15 billion",
|
|
58
|
+
indices: [
|
|
59
|
+
{ name: "linkedin_profile_pkey", type: "UNIQUE btree", columns: ["id"], notes: "Primary key" },
|
|
60
|
+
{
|
|
61
|
+
name: "ix_linkedin_profile_linkedin_user_id",
|
|
62
|
+
type: "btree",
|
|
63
|
+
columns: ["linkedin_user_id"],
|
|
64
|
+
notes: "Partial (NOT NULL)",
|
|
65
|
+
isPartial: true
|
|
66
|
+
},
|
|
67
|
+
{ name: "linkedin_profile_updated_at_idx", type: "btree", columns: ["updated_at"], notes: "Recency queries" },
|
|
68
|
+
{ name: "ix_linkedin_profile_org_tsv", type: "GIN", columns: ["org"], notes: "Full-text on org" },
|
|
69
|
+
{
|
|
70
|
+
name: "ix_linkedin_profile_random",
|
|
71
|
+
type: "btree",
|
|
72
|
+
columns: ["immutable_random(id)"],
|
|
73
|
+
notes: "Random sampling"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
table: "linkedin_profile_position3",
|
|
79
|
+
recordCount: "~2.6 billion",
|
|
80
|
+
indices: [
|
|
81
|
+
{ name: "linkedin_profile_position3_pkey", type: "UNIQUE btree", columns: ["id"], notes: "Primary key" },
|
|
82
|
+
{
|
|
83
|
+
name: "ix_linkedin_profile_position3_linkedin_profile_id",
|
|
84
|
+
type: "btree",
|
|
85
|
+
columns: ["linkedin_profile_id"],
|
|
86
|
+
notes: "Fast lookup by profile"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "ix_linkedin_profile_position3_linkedin_company_id",
|
|
90
|
+
type: "btree",
|
|
91
|
+
columns: ["linkedin_company_id"],
|
|
92
|
+
notes: "Fast lookup by company"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "ix_linkedin_profile_position3_key64",
|
|
96
|
+
type: "UNIQUE btree",
|
|
97
|
+
columns: ["key64(...)"],
|
|
98
|
+
notes: "Deduplication"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
table: "linkedin_job",
|
|
104
|
+
recordCount: "~1.48 billion",
|
|
105
|
+
indices: [
|
|
106
|
+
{ name: "linkedin_job_pkey", type: "UNIQUE btree", columns: ["id"], notes: "Primary key" },
|
|
107
|
+
{ name: "ix_linkedin_job_job_id_uniq", type: "UNIQUE btree", columns: ["job_id"], notes: "LinkedIn job ID" },
|
|
108
|
+
{
|
|
109
|
+
name: "ix_linkedin_job_company_id_ix",
|
|
110
|
+
type: "btree",
|
|
111
|
+
columns: ["linkedin_company_id"],
|
|
112
|
+
notes: "Fast lookup by company"
|
|
113
|
+
},
|
|
114
|
+
{ name: "ix_linkedin_job_title_id_ix", type: "btree", columns: ["title_id"], notes: "Title lookup" },
|
|
115
|
+
{ name: "ix_linkedin_job_updated_at", type: "btree", columns: ["updated_at"], notes: "Recency queries" },
|
|
116
|
+
{
|
|
117
|
+
name: "ix_linkedin_job_recruiter_profile_id_ix",
|
|
118
|
+
type: "btree",
|
|
119
|
+
columns: ["recruiter_profile_id"],
|
|
120
|
+
notes: "Recruiter lookup"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
table: "linkedin_profile_education2",
|
|
126
|
+
recordCount: "~965 million",
|
|
127
|
+
indices: [
|
|
128
|
+
{ name: "linkedin_profile_education2_pkey", type: "UNIQUE btree", columns: ["id"], notes: "Primary key" },
|
|
129
|
+
{
|
|
130
|
+
name: "ix_linkedin_profile_education2_linkedin_profile_id",
|
|
131
|
+
type: "btree",
|
|
132
|
+
columns: ["linkedin_profile_id"],
|
|
133
|
+
notes: "Fast lookup by profile"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "ix_linkedin_profile_education2_linkedin_school_id",
|
|
137
|
+
type: "btree",
|
|
138
|
+
columns: ["linkedin_school_id"],
|
|
139
|
+
notes: "Partial (NOT NULL)",
|
|
140
|
+
isPartial: true
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "linkedin_profile_education2_md5_bigint_key",
|
|
144
|
+
type: "UNIQUE btree",
|
|
145
|
+
columns: ["md5_bigint"],
|
|
146
|
+
notes: "Deduplication"
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
table: "linkedin_crunchbase_funding",
|
|
152
|
+
indices: [
|
|
153
|
+
{ name: "linkedin_crunchbase_funding_pkey", type: "UNIQUE btree", columns: ["id"], notes: "Primary key" },
|
|
154
|
+
{
|
|
155
|
+
name: "ix_linkedin_crunchbase_funding_linkedin_company_id",
|
|
156
|
+
type: "btree",
|
|
157
|
+
columns: ["linkedin_company_id"],
|
|
158
|
+
notes: "Fast lookup by company"
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
table: "linkedin_company_slug",
|
|
164
|
+
indices: [
|
|
165
|
+
{ name: "linkedin_company_slug_pk", type: "UNIQUE btree", columns: ["id"], notes: "Primary key" },
|
|
166
|
+
{
|
|
167
|
+
name: "linkedin_company_slug_slug_key64_uniq",
|
|
168
|
+
type: "UNIQUE btree",
|
|
169
|
+
columns: ["slug_key64"],
|
|
170
|
+
notes: "Fast lookup via key64()"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "linkedin_company_slug_linkedin_company_id_ix",
|
|
174
|
+
type: "btree",
|
|
175
|
+
columns: ["linkedin_company_id"],
|
|
176
|
+
notes: "Company lookup"
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
table: "linkedin_profile_slug",
|
|
182
|
+
recordCount: "~1.14 billion",
|
|
183
|
+
indices: [
|
|
184
|
+
{ name: "linkedin_profile_slug_pk", type: "UNIQUE btree", columns: ["id"], notes: "Primary key" },
|
|
185
|
+
{
|
|
186
|
+
name: "linkedin_profile_slug_slug_key64_idx",
|
|
187
|
+
type: "btree",
|
|
188
|
+
columns: ["slug_key64"],
|
|
189
|
+
notes: "Fast lookup via key64()"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: "linkedin_profile_slug_linkedin_profile_id_ix",
|
|
193
|
+
type: "btree",
|
|
194
|
+
columns: ["linkedin_profile_id"],
|
|
195
|
+
notes: "Profile lookup"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: "linkedin_profile_slug_linkedin_user_id_ix",
|
|
199
|
+
type: "btree",
|
|
200
|
+
columns: ["linkedin_user_id"],
|
|
201
|
+
notes: "User ID lookup"
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
table: "linkedin_industry",
|
|
207
|
+
indices: [
|
|
208
|
+
{ name: "linkedin_industry_pkey", type: "UNIQUE btree", columns: ["id"], notes: "Primary key" },
|
|
209
|
+
{ name: "linkedin_industry_alt_names_uniq", type: "GiST", columns: ["alt_names"], notes: "Name matching" }
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
table: "person",
|
|
214
|
+
recordCount: "~1.32 billion",
|
|
215
|
+
indices: [
|
|
216
|
+
{ name: "person_pkey", type: "UNIQUE btree", columns: ["id"], notes: "Primary key" },
|
|
217
|
+
{
|
|
218
|
+
name: "ix_person_linkedin_profile_id",
|
|
219
|
+
type: "btree",
|
|
220
|
+
columns: ["linkedin_profile_id"],
|
|
221
|
+
notes: "Fast lookup by profile"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "ix_person_first_last_name_tsv",
|
|
225
|
+
type: "GIN",
|
|
226
|
+
columns: ["first_name", "last_name", "formatted_name"],
|
|
227
|
+
notes: "Full-text name search"
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
table: "company",
|
|
233
|
+
indices: [
|
|
234
|
+
{ name: "company_pkey", type: "UNIQUE btree", columns: ["id"], notes: "Primary key" },
|
|
235
|
+
{ name: "company_slug_key", type: "UNIQUE btree", columns: ["slug"], notes: "Slug lookup" },
|
|
236
|
+
{ name: "ix_company_linkedin_id", type: "UNIQUE btree", columns: ["linkedin_id"], notes: "LinkedIn lookup" },
|
|
237
|
+
{ name: "ix_company_employee_count", type: "btree", columns: ["employee_count"], notes: "Size queries" }
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
table: "company_type",
|
|
242
|
+
indices: []
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
table: "linkedin_article",
|
|
246
|
+
indices: [{ name: "linkedin_article_linkedin_profile_id_ix", type: "btree", columns: ["linkedin_profile_id"] }]
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
table: "linkedin_patent",
|
|
250
|
+
indices: []
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
table: "linkedin_project",
|
|
254
|
+
indices: [{ name: "ix_linkedin_project_title", type: "btree", columns: ["title"] }]
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
table: "linkedin_publication2",
|
|
258
|
+
indices: []
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
table: "linkedin_proserve_service",
|
|
262
|
+
indices: []
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
table: "linkedin_industry_naics_code_mapping",
|
|
266
|
+
indices: []
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
// ===================
|
|
270
|
+
// REFERENCE TABLES
|
|
271
|
+
// ===================
|
|
272
|
+
{
|
|
273
|
+
table: "linkedin_school",
|
|
274
|
+
indices: []
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
table: "linkedin_language",
|
|
278
|
+
indices: []
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
table: "language_proficiency",
|
|
282
|
+
indices: []
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
table: "linkedin_specialty",
|
|
286
|
+
indices: []
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
table: "linkedin_work_modality",
|
|
290
|
+
indices: []
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
table: "country",
|
|
294
|
+
indices: []
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
table: "locality",
|
|
298
|
+
indices: []
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
table: "naics_code",
|
|
302
|
+
indices: []
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
// ===================
|
|
306
|
+
// JOB TAXONOMY TABLES
|
|
307
|
+
// ===================
|
|
308
|
+
{
|
|
309
|
+
table: "job_title",
|
|
310
|
+
indices: []
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
table: "job_function",
|
|
314
|
+
indices: []
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
table: "job_seniority",
|
|
318
|
+
indices: []
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
table: "job_employment_type",
|
|
322
|
+
indices: []
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
table: "job_academic_qualification",
|
|
326
|
+
indices: []
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
// ===================
|
|
330
|
+
// PROFILE DETAIL TABLES
|
|
331
|
+
// ===================
|
|
332
|
+
{
|
|
333
|
+
table: "linkedin_profile_certification",
|
|
334
|
+
indices: [
|
|
335
|
+
{
|
|
336
|
+
name: "ix_linkedin_profile_certification_linkedin_profile_id",
|
|
337
|
+
type: "btree",
|
|
338
|
+
columns: ["linkedin_profile_id"]
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
table: "linkedin_profile_award",
|
|
344
|
+
indices: [
|
|
345
|
+
{ name: "ix_linkedin_profile_award_linkedin_profile_id", type: "btree", columns: ["linkedin_profile_id"] }
|
|
346
|
+
]
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
table: "linkedin_profile_project",
|
|
350
|
+
indices: [
|
|
351
|
+
{ name: "ix_linkedin_profile_project_linkedin_profile_id", type: "btree", columns: ["linkedin_profile_id"] },
|
|
352
|
+
{ name: "ix_linkedin_profile_project_linkedin_project_id", type: "btree", columns: ["linkedin_project_id"] }
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
table: "linkedin_profile_volunteer_experience",
|
|
357
|
+
indices: [
|
|
358
|
+
{
|
|
359
|
+
name: "ix_linkedin_profile_volunteer_experience_linkedin_profile_id",
|
|
360
|
+
type: "btree",
|
|
361
|
+
columns: ["linkedin_profile_id"]
|
|
362
|
+
}
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
table: "linkedin_profile_recommendation2",
|
|
367
|
+
indices: [
|
|
368
|
+
{
|
|
369
|
+
name: "ix_linkedin_profile_recommendation2_linkedin_profile_id",
|
|
370
|
+
type: "btree",
|
|
371
|
+
columns: ["linkedin_profile_id"]
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
name: "ix_linkedin_profile_recommendation2_recommender_linkedin_profile_id",
|
|
375
|
+
type: "btree",
|
|
376
|
+
columns: ["recommender_linkedin_profile_id"]
|
|
377
|
+
}
|
|
378
|
+
]
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
table: "linkedin_profile_test_scores",
|
|
382
|
+
indices: []
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
table: "linkedin_profile_language_proficiency",
|
|
386
|
+
indices: []
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
table: "linkedin_profile_course",
|
|
390
|
+
indices: [
|
|
391
|
+
{ name: "ix_linkedin_profile_course_linkedin_profile_id", type: "btree", columns: ["linkedin_profile_id"] }
|
|
392
|
+
]
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
table: "linkedin_profile_patent",
|
|
396
|
+
indices: [
|
|
397
|
+
{ name: "ix_linkedin_profile_patent_linkedin_profile_id", type: "btree", columns: ["linkedin_profile_id"] }
|
|
398
|
+
]
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
table: "linkedin_profile_publication2",
|
|
402
|
+
indices: [
|
|
403
|
+
{
|
|
404
|
+
name: "ix_linkedin_profile_publication2_linkedin_profile_id",
|
|
405
|
+
type: "btree",
|
|
406
|
+
columns: ["linkedin_profile_id"]
|
|
407
|
+
}
|
|
408
|
+
]
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
table: "linkedin_profile_url_resource",
|
|
412
|
+
indices: []
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
table: "linkedin_profile_url_resource_name",
|
|
416
|
+
indices: []
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
table: "linkedin_profile_priority_queue",
|
|
420
|
+
indices: []
|
|
421
|
+
},
|
|
422
|
+
|
|
423
|
+
// ===================
|
|
424
|
+
// COMPANY DETAIL TABLES
|
|
425
|
+
// ===================
|
|
426
|
+
{
|
|
427
|
+
table: "linkedin_company_address2",
|
|
428
|
+
indices: [
|
|
429
|
+
{ name: "linkedin_company_address2_linkedin_company_idx", type: "btree", columns: ["linkedin_company_id"] }
|
|
430
|
+
]
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
table: "linkedin_company_post",
|
|
434
|
+
indices: [
|
|
435
|
+
{
|
|
436
|
+
name: "ix_linkedin_company_post_linkedin_company_id_id",
|
|
437
|
+
type: "btree",
|
|
438
|
+
columns: ["linkedin_company_id", "id DESC"],
|
|
439
|
+
notes: "Composite index"
|
|
440
|
+
}
|
|
441
|
+
]
|
|
442
|
+
},
|
|
443
|
+
|
|
444
|
+
// ===================
|
|
445
|
+
// DENORMALIZED VIEWS
|
|
446
|
+
// ===================
|
|
447
|
+
{
|
|
448
|
+
table: "lkd_company",
|
|
449
|
+
indices: []
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
table: "lkd_profile",
|
|
453
|
+
indices: []
|
|
454
|
+
}
|
|
455
|
+
];
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Helper to get indices for a specific table
|
|
459
|
+
*/
|
|
460
|
+
export function getTableIndices(tableName: string): TableIndex[] {
|
|
461
|
+
const mapping = B2B_TABLE_INDICES.find((t) => t.table === tableName);
|
|
462
|
+
return mapping?.indices ?? [];
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Helper to find tables with indices on a specific column
|
|
467
|
+
*/
|
|
468
|
+
export function findIndicesByColumn(columnName: string): { table: string; index: TableIndex }[] {
|
|
469
|
+
const results: { table: string; index: TableIndex }[] = [];
|
|
470
|
+
for (const mapping of B2B_TABLE_INDICES) {
|
|
471
|
+
for (const index of mapping.indices) {
|
|
472
|
+
if (index.columns.some((col) => col.includes(columnName))) {
|
|
473
|
+
results.push({ table: mapping.table, index });
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return results;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Get all tables with their index count
|
|
482
|
+
*/
|
|
483
|
+
export function getTableIndexSummary(): { table: string; indexCount: number; recordCount?: string }[] {
|
|
484
|
+
return B2B_TABLE_INDICES.map((t) => ({
|
|
485
|
+
table: t.table,
|
|
486
|
+
indexCount: t.indices.length,
|
|
487
|
+
recordCount: t.recordCount
|
|
488
|
+
}));
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Quick lookup map for table -> indexed columns
|
|
493
|
+
*/
|
|
494
|
+
export const TABLE_INDEXED_COLUMNS: Record<string, string[]> = Object.fromEntries(
|
|
495
|
+
B2B_TABLE_INDICES.map((t) => [t.table, [...new Set(t.indices.flatMap((i) => i.columns))]])
|
|
496
|
+
);
|
package/package.json
CHANGED