Mercurial > gemma
comparison pkg/imports/track.go @ 4036:e45442db19b1 faster-agm
First stab to make AGM imports faster by avoiding unnecessary inserts. Also delete un-updated measures in time ranges.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 24 Jul 2019 11:46:41 +0200 |
parents | 59055c8301df |
children |
comparison
equal
deleted
inserted
replaced
4035:f2d5bf42ed38 | 4036:e45442db19b1 |
---|---|
20 | 20 |
21 const ( | 21 const ( |
22 trackImportSQL = ` | 22 trackImportSQL = ` |
23 INSERT INTO import.track_imports (import_id, relation, key) | 23 INSERT INTO import.track_imports (import_id, relation, key) |
24 VALUES ($1, $2::regclass, $3)` | 24 VALUES ($1, $2::regclass, $3)` |
25 | |
26 trackImportDeletionSQL = ` | |
27 INSERT INTO import.track_imports (import_id, deletion, relation, key) | |
28 VALUES ($1, $4, $2::regclass, $3)` | |
25 ) | 29 ) |
26 | 30 |
27 func track(ctx context.Context, tx *sql.Tx, importID int64, relation string, key int64) error { | 31 func track(ctx context.Context, tx *sql.Tx, importID int64, relation string, key int64) error { |
28 _, err := tx.ExecContext(ctx, trackImportSQL, importID, relation, key) | 32 _, err := tx.ExecContext(ctx, trackImportSQL, importID, relation, key) |
29 return err | 33 return err |