Mysql - What is the best index to be created in this case

0

Hello,

I have a table in the database with the historical prices of products. This table is very bulky with more than 1 billion records.

How can I create an index in this table, to answer the query below:

select 
    cd_produto_price,
    min(vlr_produto) as vlr_produto 
from 
    preco_produto_fornecedor 
where 
    dt_atualizacao < date(now()) 
and vlr_produto > 0 
group by 
    cd_produto_price;

Possible indexes:

  • Only the field of update
  • Only the vlr_produto field
  • UpdateTypes, vlr_product
  • UpdateTypes, vlr_product, and cd_product
  • Any other options?
  • Note: I need to create the right index, because the base is already very large (disk space)

        
    asked by anonymous 10.10.2016 / 01:26

    0 answers