aboutsummaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
Diffstat (limited to 'app/services')
-rw-r--r--app/services/help-service.ts7
-rw-r--r--app/services/plan-service.ts1
-rw-r--r--app/services/syntax-highlight-service.ts27
3 files changed, 24 insertions, 11 deletions
diff --git a/app/services/help-service.ts b/app/services/help-service.ts
index 8859c24..0195aff 100644
--- a/app/services/help-service.ts
+++ b/app/services/help-service.ts
@@ -12,11 +12,14 @@ export var NODE_DESCRIPTIONS = {
"NESTED LOOP": `merges two record sets by looping through every record in the first set and
trying to find a match in the second set. All matching records are returned.`,
"MERGE JOIN": `merges two record sets by first sorting them on a <strong>join key</strong>.`,
+ "HASH": `generates a hash table from the records in the input recordset. Hash is used by
+ <strong>Hash Join</strong>.`,
+ "HASH JOIN": `joins to record sets by hashing one of them (using a <strong>Hash Scan</scan>).`,
"AGGREGATE": `groups records together based on a GROUP BY or aggregate function (like <code>sum()</code>).`,
"HASHAGGREGATE": `groups records together based on a GROUP BY or aggregate function (like sum()). Hash Aggregate uses
a hash to first organize the records by a key.`,
- "SEQ SCAN": `finds relevant records by sequentially scanning the table. Seq Scans perform a single read operation
- (only the table is read).`,
+ "SEQ SCAN": `finds relevant records by sequentially scanning the input record set. When reading from a table,
+ Seq Scans (unlike Index Scans) perform a single read operation (only the table is read).`,
"INDEX SCAN": `finds relevant records based on an <strong>Index</strong>. Index Scans perform 2 read operations: one to
read the index and another to read the actual value from the table.`,
"INDEX ONLY SCAN": `finds relevant records based on an <strong>Index</strong>. Index Only Scans perform a single read operation
diff --git a/app/services/plan-service.ts b/app/services/plan-service.ts
index 2e56bac..bf74c38 100644
--- a/app/services/plan-service.ts
+++ b/app/services/plan-service.ts
@@ -19,6 +19,7 @@ export class PlanService {
SORT_KEY_PROP: string = 'Sort Key';
JOIN_TYPE_PROP: string = 'Join Type';
INDEX_NAME_PROP: string = 'Index Name';
+ HASH_CONDITION_PROP: string = 'Hash Cond';
// computed by pev
COMPUTED_TAGS_PROP: string = "*Tags";
diff --git a/app/services/syntax-highlight-service.ts b/app/services/syntax-highlight-service.ts
index d082bde..17f6e61 100644
--- a/app/services/syntax-highlight-service.ts
+++ b/app/services/syntax-highlight-service.ts
@@ -2,20 +2,29 @@
/// <reference path="lodash.d.ts" />
export class SyntaxHighlightService {
- init() {
+ OPEN_TAG: string = ' _OPEN_TAG_';
+ CLOSE_TAG: string = '_CLOSE_TAG_';
+
+ highlight(code: string, keyItems: Array<string>) {
hljs.registerLanguage('sql', LANG_SQL);
- }
- highlight(code) {
hljs.configure({
tabReplace: ' ', // 4 spaces
});
- return hljs.highlightAuto(code).value;
- }
- highlightKeyItems(value: string, keyItems: Array<string>) {
- _.each(keyItems, (keyItem) => { value = value.replace(keyItem, `<span class='code-key-item'>${keyItem}</span>`) })
- return value;
+ // prior to syntax highlighting, we want to tag key items in the raw code. making the
+ // query upper case and ensuring that all comma separated values have a space
+ // makes it simpler to find the items we're looing for
+ var result: string = code.toUpperCase().replace(', ', ',');
+ _.each(keyItems, (keyItem: string) => {
+ result = result.replace(keyItem.toUpperCase(), `${this.OPEN_TAG}${keyItem}${this.CLOSE_TAG}`)
+ });
+
+ result = hljs.highlightAuto(result).value;
+ result = result.replace(new RegExp(this.OPEN_TAG, 'g'), "<span class='code-key-item'>")
+ result = result.replace(new RegExp(this.CLOSE_TAG, 'g'), "</span>");
+
+ return result;
}
}
@@ -43,7 +52,7 @@ export var LANG_SQL = function(hljs) {
'authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile ' +
'before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float ' +
'binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound ' +
- 'buffer_cache buffer_pool build bulk by byte byteordermark bytes c cache caching call calling cancel ' +
+ 'buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel ' +
'capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base ' +
'char_length character_length characters characterset charindex charset charsetform charsetid check ' +
'checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close ' +