mirror of
https://github.com/gabehf/Koito.git
synced 2026-04-22 20:11:50 -07:00
Add bulk import optimization: track_lookup cache, batch inserts, BulkSubmitter
This commit is contained in:
parent
0ec7b458cc
commit
ae373a7090
21 changed files with 1296 additions and 125 deletions
21
db/queries/track_lookup.sql
Normal file
21
db/queries/track_lookup.sql
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
-- name: GetTrackLookup :one
|
||||
SELECT artist_id, album_id, track_id
|
||||
FROM track_lookup
|
||||
WHERE lookup_key = $1;
|
||||
|
||||
-- name: InsertTrackLookup :exec
|
||||
INSERT INTO track_lookup (lookup_key, artist_id, album_id, track_id)
|
||||
VALUES ($1, $2, $3, $4)
|
||||
ON CONFLICT (lookup_key) DO UPDATE SET
|
||||
artist_id = EXCLUDED.artist_id,
|
||||
album_id = EXCLUDED.album_id,
|
||||
track_id = EXCLUDED.track_id;
|
||||
|
||||
-- name: DeleteTrackLookupByArtist :exec
|
||||
DELETE FROM track_lookup WHERE artist_id = $1;
|
||||
|
||||
-- name: DeleteTrackLookupByAlbum :exec
|
||||
DELETE FROM track_lookup WHERE album_id = $1;
|
||||
|
||||
-- name: DeleteTrackLookupByTrack :exec
|
||||
DELETE FROM track_lookup WHERE track_id = $1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue