    DROP INDEX IF EXISTS akuz.ix_t_card_note_filtered_1;
    CREATE INDEX ix_t_card_note_filtered_1
        ON akuz.t_card_note (emdrdoctype)
        WHERE (readytobesent = 1 AND isdelayed = 0);

    DROP INDEX IF EXISTS akuz.ix_t_emdr_doc_type_wheretosend;
    CREATE INDEX ix_t_emdr_doc_type_wheretosend
        ON akuz.t_emdr_doc_type (sendingprioritet);

    DROP INDEX IF EXISTS akuz.ix_t_emdr_message_filtered_1;
    CREATE INDEX ix_t_emdr_message_filtered_1
        ON akuz.t_emdr_message (wheretosend, registrationstate)
        INCLUDE (cardnote)
        WHERE (registrationstate = 0);