Howdy Jesper,
> Sorry - looked a bit further into you table syntax
>
> Since both emp and ano are primary keys already - only set non-unique
> composite index on (arm_cod, cod_art)
>
> Maybe you could enlighten me by explaing why using many primary indexes
> instead of on primary and several unique composite indexes
>
Yap, after i sent the email i saw that i was missing the index's.
I always fall on that error :P
>
> Setting non-unique composite index on (emp, ano, arm_cod, cod_art)
> should make the query real fast. Indexes are most important for finding
> what rows to look in. Ie in this case - the parameters within WHERE.
> Indexing columns that are not used in WHERE syntaxes or in JOIN
> syntaxes are rarely useful, only space consuming. Indexeing also
> somewhat slows down UPDATEs and INSERTs. Normally not a hazzle unless a
> lot of fields are often updated and inserted.
>
> You ought to be fine with only non-unique composite index on (emp, ano,
> arm_cod, cod_art)
>
> /Jesper