Fix old-data deletion query

This commit is contained in:
Christian Kamm 2021-11-01 16:35:19 +01:00
parent cf1de61d4c
commit 9fd1f4d25d
1 changed files with 3 additions and 1 deletions

View File

@ -511,7 +511,9 @@ fn init_postgres(
let query = query!(" \
DELETE FROM account_write \
USING ( \
SELECT DISTINCT ON(pubkey) pubkey, slot, write_version FROM account_write \
SELECT DISTINCT ON(pubkey) pubkey, slot, write_version \
FROM account_write \
INNER JOIN slot USING(slot) \
WHERE slot <= $newest_final_slot AND status = 'rooted' \
ORDER BY pubkey, slot DESC, write_version DESC \
) latest_write \