You must create a multi-column index, like this:

create index test_index on test_table ( f2 asc, F1 asc)

then, when you run the optimizer on this:
EXPLAIN

SELECT F2, MAX(F1) AS F1 FROM TEST_TABLE GROUP BY F2

or this

EXPLAIN

SELECT F1, MAX(F2) AS F2 FROM TEST_TABLE GROUP BY F1

it will show:

TEST TEST_TABLE  TEST_INDEX  MULTIPLE INDEX COLUMN USED (INDEX SCAN)
                         F2               (USED INDEX COLUMN)
                         F1               (USED INDEX COLUMN)
TEST    RESULT IS COPIED   , COSTVALUE IS

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



-- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to