Issue information

Issue ID
#3072
Status
Duplicate
Severity
Medium
Started
Hercules Elf Bot
May 12, 2009 22:21
Last Post
Hercules Elf Bot
May 12, 2009 22:21
Confirmation
N/A

Hercules Elf Bot - May 12, 2009 22:21

Originally posted by [b]hermematon[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3072

It need a Index in the "mail" table cause this query in int_mail.c can slow down a lot the MySQL DB:

CODE
    StringBuf_AppendStr(&buf, "SELECT `id`,`send_name`,`send_id`,`dest_name`,`dest_id`,`title`,`message`,`time`,`status`,"
        "`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`");
    for (i = 0; i < MAX_SLOTS; i++)
        StringBuf_Printf(&buf, ",`card%d`", i);

    // I keep the `status` < 3 just in case someone forget to apply the sqlfix
    StringBuf_Printf(&buf, " FROM `%s` WHERE `dest_id`='%d' AND `status` < 3 ORDER BY `id` LIMIT %d",
        mail_db, char_id, MAIL_MAX_INBOX + 1);


When the Mail DB grows and have lots of mails this can be a problem without a index to speed the search.

Regards.