I divided table on two parts, but MySQL scanning full table
Discuss I divided table on two parts, but MySQL scanning full table in the MySQL Help forum on Dev Shed. I divided table on two parts, but MySQL scanning full table MySQL Help forum discussing administration, SQL syntax, and other MySQL-related topics. MySQL is an open-source relational database management system (RDBMS).
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month! Download and Activate to enter!
Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.
Posts: 11
Time spent in forums: 4 h 43 m 38 sec
Reputation Power: 0
Partition, How to divide the table into 1000 part
Hello
There is a table, into the table is a field id
It is expected that, in this table awaken 1 billion REC.
I want to divide (through partition) this table so that:
Everi part contained one million REC.
I make this so:
Posts: 4,314
Time spent in forums: 3 Weeks 3 Days 12 h 26 m 54 sec
Reputation Power: 448
You could write a script in your favorite scripting language that outputs the SQL statements instead of writing each by hand.
Also just curious how far away in time are you planning to reach 1,000,000,000 records? Because you don't have to create all partitions right now but instead as you go along and I've heard to many times that -"we need to plan for 500 million rows" and they never reach even 1 million.
Also how large is one record? Do you really need to cap it at 1 million, can't you allow 10 million instead.
Posts: 11
Time spent in forums: 4 h 43 m 38 sec
Reputation Power: 0
I divided table on two parts, but MySQL scanning full table
Hello.
I write this query:
CREATE TABLE qwe(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
PRIMARY KEY(id)
)
PARTITION BY RANGE(id) (
PARTITION p_1 VALUES LESS THAN(50000),
PARTITION p_2 VALUES LESS THAN(MAXVALUE)
)
After, I insert into the table 100 000 record.
After, I make query with EXPLAIN ()
$res = mysqli_query($db, "EXPLAIN PARTITIONS SELECT name FROM qwe WHERE id > 70000");
while($row = mysqli_fetch_assoc($res)) {
echo $row["partitions"].' , '.$row["rows"].' <br>';
}
resultat: p_2 , 100000
rezultat from "rows" is 100000.
Question: the table is divided the two parts, but MySQL scanning full table, why?
Please answer me if my question is clearly, this is very Important for me.
Posts: 4,314
Time spent in forums: 3 Weeks 3 Days 12 h 26 m 54 sec
Reputation Power: 448
Quote:
Originally Posted by dadli
...
resultat: p_2 , 100000
rezultat from "rows" is 100000.
Question: the table is divided the two parts, but MySQL scanning full table, why?
No the single "p_2" means that it is only using the p_2 partition.
While the rows value is the total number of rows in the _table_ and has nothing to do with how many rows that has been involved in the execution of the query.