alter table CONNECTIONS_MSGS add index DEST_SEQNUM_IDX (destination, smsc_sequencenumber)
alter table CONNECTIONS_MSGS add index DEST_MSGID_IDX (destination, smsc_messageid)
alter table CONNECTIONS_MSGS add index TO_IDX (smsc_to)
alter table CONNECTIONS_MSGS add index STATUS_IDX (status)
alter table APPLICATIONS_MSGS add index DEST_SEQNUM_IDX (destination, smsc_sequencenumber)
alter table APPLICATIONS_MSGS add index DEST_MSGID_IDX (destination, smsc_messageid)
alter table CONNECTIONS_MSGS add index DEST_SEQNUM_IDX (destination, smsc_sequencenumber) alter table CONNECTIONS_MSGS add index DEST_MSGID_IDX (destination, smsc_messageid) alter table CONNECTIONS_MSGS add index TO_IDX (smsc_to) alter table CONNECTIONS_MSGS add index STATUS_IDX (status)
alter table APPLICATIONS_MSGS add index DEST_SEQNUM_IDX (destination, smsc_sequencenumber) alter table APPLICATIONS_MSGS add index DEST_MSGID_IDX (destination, smsc_messageid)
And also an index to creation_time