| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 23 Feb 2010 14:30:38
|
David_
Member
Joined: 10 Apr 2008 16:25:24
Messages: 25
Offline
|
The code below reduces the time needed to create a table, like the following, by an order of magnitude:
create table testpartitioning_partitioned (da varchar(40) NOT NULL) partitioning key da on all;
It is especially true if the coordinator is run on a node without any database (as in my testing environment).
When creating a table, 256 queries of the following type are currently run:
INSERT INTO xsystabparthash (parthashid, tableid, dbid, hashValue, nodeid) VALUES (254, 2, 1, 253, 2)
INSERT INTO xsystabparthash (parthashid, tableid, dbid, hashValue, nodeid) VALUES (255, 2, 1, 254, 3)
INSERT INTO xsystabparthash (parthashid, tableid, dbid, hashValue, nodeid) VALUES (256, 2, 1, 255, 1)
The code below merges this into a single query like the following:
INSERT INTO xsystabparthash (parthashid, tableid, dbid, hashValue, nodeid) VALUES (254, 2, 1, 253, 2), (255, 2, 1, 254, 3), (256, 2, 1, 255, 1)
The following is the only method, which needs to change. It is located in the HashPartitionMap class:
This message was edited 1 time. Last update was at 23 Feb 2010 14:32:38
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 24 Feb 2010 17:03:49
|
Mason_S
Senior member
Joined: 1 Apr 2008 09:03:08
Messages: 380
Offline
|
Thanks, David.
I appreciate you submitting a change.
I think we will hold off on adding this one for now since it may not be portable to other underlying databases. If we do add it, we would enable it by default and allow it to be turned off via the gridsql.conf file.
BTW, the reason why we bother inserting those rows is to make future repartitioning easier in the future, where we could move a subset of data to a new node, but that has not been implemented.
Regards,
Mason
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 25 Feb 2010 16:43:48
|
David_
Member
Joined: 10 Apr 2008 16:25:24
Messages: 25
Offline
|
Hi Mason,
Thanks for the answer. I understand your reason for not adding the patch. For the record though, I will submit another one, which further increases the speed of creating a table, especially if the table has a lot of columns like mine. In my case it reduces 30 queries (one for each of my 30 columns) to one query. The only method to be changed is addTableColumns in MetaUtils.java.
One question, Mason. Is there any easier way for me to suggest changes to the code other than making a post here? I do not expect to be able to directly committ changes to the code, but being able to in some way make suggested changes to the code could be useful. Especially changes that affect more than one method or class.
This message was edited 2 times. Last update was at 25 Feb 2010 16:45:54
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 1 Mar 2010 03:50:20
|
Mason_S
Senior member
Joined: 1 Apr 2008 09:03:08
Messages: 380
Offline
|
Hi David,
Please feel free to post any patches here.
If you prefer, you may also first privately send me a message.
Regards,
Mason
|
|
|
 |
|
|
|
|