Thanks for your reply.
Further question on indexes on temporary table.
if I include the indexes when creating a temporary table
Code:
CREATE TEMPORARY TABLE `rank_temp` (
`id` BIGINT UNSIGNED NOT NULL,
`rank1` INT NOT NULL ,
`data1` DOUBLE NOT NULL ,
`rank2` INT NOT NULL ,
`data2` DOUBLE NOT NULL ,
PRIMARY KEY ( `id` ) ,
INDEX ( `data1` ) ,
INDEX ( `data2` )
) ENGINE = MEMORY;
then I populate it
Code:
INSERT INTO rank_temp (id, rank1, data1, rank2, data2)
SELECT id, 0, data1, 0, data2
FROM rankme;
in this case, do I still need to use the following statements to explicitly create indexes
Code:
create index idx_test on rank_temp (data1);
create index idx_test on rank_temp (data2);