Hi, I have a table storing user IDs and the times those users did a certain thing. Sometimes we want to know what a user did in a certain time period, so we add a multi-key to the table:
From time to time we'd like to delete older entries irregardless of which user they belong to, so a second key comes along (because the second column of the multi-key above cannot be used alone):
Can the same same two queries be index-optimized with two one-column keys? Something like:
Thanks.
Quote:So this can be done efficiently: SELECT * FROM t WHERE uid='...' AND start BETWEEN '...' AND '...';KEY `uid` (`uid`,`start`)
From time to time we'd like to delete older entries irregardless of which user they belong to, so a second key comes along (because the second column of the multi-key above cannot be used alone):
Quote:So this can be done efficiently: DELETE FROM t WHERE start<'...';KEY `start` (`start`)
Can the same same two queries be index-optimized with two one-column keys? Something like:
Quote:KEY `uid` (`uid`),
KEY `start` (`start`)
Thanks.