-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Simon Gray wrote:
| John Fawcett wrote:
|> Simon
|>
|> I doubt that splitting the queries will change whether an index is used.
|> The potential index on mailbox_idnr is not a good one when there are
|> many rows corresponding to mailbox_idnr.
|>
|> Did you try to explain the separated queries? The behaviour should be
|> the same as in the combined select.
|>
|> John
| John,
|
| It doesn't actually use the mailbox_idnr key (at least not in my
| environment) it is using the mailbox_status instead. I think the problem
| relies within mysql rather than dbmail here, mysql will internally use
| its temptable algorithm on unions like this.
|
| http://bugs.mysql.com/bug.php?id=29244
|
| You are correct, the behaviour is the same on each individual query
| except the union result part.
|
Simon
also, if you try an explain of the query on a mailbox with few messages,
mysql will use the index on mailbox_idnr because (presumably) that
is a better policy than range scan on mailbox_status if there are
few matching index rows.
John
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFIG03Md4I3jTtt9EIRAkJ0AJ0TTAF0CVVvogiFg8WexT8dxomUvQCgnQxv
H2ucd1WiysGDPfVGTQxRf3M=
=prGy
-----END PGP SIGNATURE-----
_______________________________________________
Dbmail-dev mailing list
[email protected]
http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Reply via email to