On Thu, Mar 10, 2005, Thomas Mueller <[EMAIL PROTECTED]> said: > Hi, > > now I have only one slow query left - unfortunately I have no idea why > it is that slow. The mailbox contains ~1800 mails. It takes 45 seconds > to open it: > > SELECT seen_flag, answered_flag, deleted_flag, flagged_flag, draft_flag, > recent_flag, TO_CHAR(internal_date, 'YYYY-MM-DD HH24:MI:SS' ), rfcsize, > message_idnr FROM dbmail_messages msg, dbmail_physmessage pm WHERE pm.id > = msg.physmessage_id AND message_idnr BETWEEN '1' AND '417966' AND > mailbox_idnr = '81' AND status < '2' ORDER BY message_idnr ASC
Wild. Swapping in the MySQL function for TO_CHAR, then running on my mailbox takes 0.32 seconds for 4518 rows (I didn't change your numbers except the mailbox idnr). Aaron