MySQL Forums
Forum List  »  General

Re: Partitions and performance
Posted by: Rick James
Date: February 13, 2014 10:14PM

Step 1. Shrink the data. Smaller -> less I/O -> faster.

Some examples:

> `Patient_Id` BIGINT(10) NOT NULL DEFAULT '0',

BIGINT lets you have more than 4 billion ids. Do you need that much? BIGINT takes 8 bytes. MEDIUMINT UNSIGNED has a range of 0..16M, and takes only 3 bytes.

`YEAR` BIGINT(4) NOT NULL DEFAULT '0',

There is a YEAR datatype; it takes 2 bytes (vs 8).

> INT(255)

The number (255) means nothing (unless you use ZEROFILL). INT takes 4 bytes and (when SIGNED) has a range of -2 billion to +2 billion.

> DOUBLE(18,14)

Largest value is only 9999.99999999999999. Is that what you expected? It takes 9 bytes (I think). Consider DOUBLE or FLOAT.

> KEY `idx_year` (`YEAR`),

It is rarely useful to index fields with low cardinality.

> KEY `idx_year` (`YEAR`),
> KEY `idx_big` (`YEAR`,`Patient_Id`,`crisk`,`drisk`,`zrisk`,`arisk`,`acrisk`)

The second of those indexes handles cases where you might think to use the first.

> KEY `idx_big` (`YEAR`,`Patient_Id`,`crisk`,`drisk`,`zrisk`,`arisk`,`acrisk`)

What is the intent of this index?

I see no PRIMARY KEY or other UNIQUE key. This seems unlikely.

> key_buffer_size 57671680

How much RAM do you have _available_ to MySQL? That number should be about 20%.

> lets say if we select dimension A then we have to group the values to the respective diemension, same applicable for the rest of the dimension.

Please provide some concrete examples.

Options: ReplyQuote


Subject
Written By
Posted
February 06, 2014 06:28AM
February 07, 2014 12:57PM
February 12, 2014 07:04AM
Re: Partitions and performance
February 13, 2014 10:14PM
February 14, 2014 12:44AM
February 15, 2014 11:36AM
February 17, 2014 06:43AM
February 17, 2014 12:45PM
February 18, 2014 11:36AM
February 18, 2014 11:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.