List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:March 15 2001 11:35pm
Subject:Re: should index usage depend on which table's columns are SELECTed ?
View as plain text  
Hi!

>>>>> "Philip" == Philip Lijnzaad <lijnzaad@stripped> writes:

Philip> On Thu, 15 Mar 2001 15:47:08 +0200 (EET), 
Philip> "Michael" == Michael Widenius <monty@stripped> wrote:

Michael> Check the 'rows' column.  According to this the 'weight' of the query
Michael> is about 8*1829*2920 = 42 M rows

Philip> <snip>

Michael> And the weight of this is just: 292016*19*8 = 44 M rows. Using disk
Michael> scanning this is reduced to 'just' 4M rows, as you can read about 10
Michael> rows while scanning at the same time you read one row with indexing.

Philip> Ah, that starts to make sense! Many many thanks. I am still a bit puzzled why
Philip> MySQL ignore my `USE INDEX(PRIMARY)' hint though.

It didn't.

The USE INDEX(PRIMARY) just tells MySQL that this is the only index it
should use.  In this case it decided that a table scan was even better
than using this index.

Regards,
Monty
Thread
should index usage depend on which table's columns are SELECTed ?Philip Lijnzaad14 Mar
  • should index usage depend on which table's columns are SELECTed ?Michael Widenius15 Mar
  • Re: should index usage depend on which table's columns are SELECTed ?Philip Lijnzaad15 Mar
    • Re: should index usage depend on which table's columns are SELECTed ?Michael Widenius15 Mar
  • Re: should index usage depend on which table's columns are SELECTed ?Philip Lijnzaad15 Mar
    • Re: should index usage depend on which table's columns are SELECTed ?Michael Widenius16 Mar