Hi All,
I have a mysql database where tables are very simple. An example table will look like this:
create table myTable(
token varchar(255) not null primary key,
token_count int default 1,
frequency int
) type=INNODB;
A java program populates this table. The program reads from files (in batch mode) and inserts into myTable with following logic:
(1) See if the String to be inserted is present in myTable.(Uses SELECT)
(2) If not present the insert into myTable (uses INSERT)
(3) If yes update the table after adding the current frequency (USES UPDATE)
After processing each file issue COMMIT.
This goes on well for some time - but after the Table grows over 100,000 rows the process slows down considerably. The Strings I 'm handling is very large and I'm not sure how well Mysql behaves with very large String as primary Key.
My select and update statements are all based upon primary key(token in this case) - so question of setting index doesn't arise. Even then I have set index on token field - but it has degraded the performance. Also I have set the query_cache_size to 1MB even then it is not enhancing the performance.
A sample file has almost 30,00 to 50,000 lines. Each line having a string + blank + frequency.
After processing first few files - the Java program takes large time to process a single file - and subsequently the processing time increases exponentially.(as the tabel grows in size it slows down).
Any suggestion how to improve the performance will be greatly appreciated.
Thanking all in advance.
I have a mysql database where tables are very simple. An example table will look like this:
create table myTable(
token varchar(255) not null primary key,
token_count int default 1,
frequency int
) type=INNODB;
A java program populates this table. The program reads from files (in batch mode) and inserts into myTable with following logic:
(1) See if the String to be inserted is present in myTable.(Uses SELECT)
(2) If not present the insert into myTable (uses INSERT)
(3) If yes update the table after adding the current frequency (USES UPDATE)
After processing each file issue COMMIT.
This goes on well for some time - but after the Table grows over 100,000 rows the process slows down considerably. The Strings I 'm handling is very large and I'm not sure how well Mysql behaves with very large String as primary Key.
My select and update statements are all based upon primary key(token in this case) - so question of setting index doesn't arise. Even then I have set index on token field - but it has degraded the performance. Also I have set the query_cache_size to 1MB even then it is not enhancing the performance.
A sample file has almost 30,00 to 50,000 lines. Each line having a string + blank + frequency.
After processing first few files - the Java program takes large time to process a single file - and subsequently the processing time increases exponentially.(as the tabel grows in size it slows down).
Any suggestion how to improve the performance will be greatly appreciated.
Thanking all in advance.