Slow performance on MySQL 5.6 trigger -


I have a large table with 80 million rows and triggers that update two other tables, all of them are Tokuthi Server Parcano 5.6 is running

  create table 'main' (`id 'int (11) tap atangment, timestamp's timestamp tap default cURRENT_TIMESTAMP,` ip_addr` varchar (50) null DEFAULT '', 'Username' varchar (255) tap default ''. Primary key (`id`),) engine = tokudi.   

is the trigger code

  if NEW.ip_addr ; & Gt; "" THEN - Get the current oldest date - set @maxdate: = now (); Set @maxdate: = (choose listeen from uniq_ip where data = NEW.ip_addr); Include in the UIIIDID (`data`,` total`, 'lustine') (new apiadar, 1, newtemstamp, @sunet) Key duplicate key update total = total + 1, alstein = latest_date (nuitimestamp, @ maxdate ); end if; - Get all the prices at one time, its indexed query comes from the index. If NEW.username & lt; & Gt; "THEN" - Current Date Date Set: @maxdate: = (Choose listseen from uniq_username where data = NEW.username); Key update of duplicates on INSERT (new user name, 1, new teststamp) in the name of the UII-UN name (`data`,` total`, `heavenly`) = Total = total + 1, lastseen = latest_date (NEW.timestamp) , @maxdate); end if;   

and uniq_username and uniq_ip

  create tab 'uniq_ip` (`data' varchar (42) no, zero,` total` medium (4) Unsigned, less than '0', 'lastseen' timestamp not zero default '0000-00-00 00:00:00', primary key (`data`), key 'idx_lastseen` (` data`, `lastseen`) )) Engines = Tokuthi default charetate = ASCI; Table 'UNICAUUSERMAN' (`data 'varchar (255)) Character set Latin 1 No, zero,` Total` moderate (4) unsigned Not less than zero' 0 ',' lastseen 'zero hour of day-time' 0000- 00-00 00:00: 00 ', primary key (`data`), key' idx_data_time` (` data`, 'heavenly')) engine = tokudi default charge = utf 8;   

The problem is that a bulk insert under load works fully on the user's name when the timing value is calculated, however, to do this on the uniq_ip table The first part joins the rate of 800 / s to 30 / s when it processes

set @maxdate: = (choose lisheen from uniq_ip) data = NEW.ip_addr);

If you get () now, its fast (but not the right result). Uniq_username and uniq_ip have the same structure and indexed and the trigger is slowed down right, even if you do the first (user name or IP) process but only the above statement which triggers down the trigger

The problem below If uniq_ip is table or toukadabi or inaudib and does not make any difference to the default charset, neither the insert statement is active or comment.

Thanks

main.ip_addr was casting as a Latin1 and UNIQUE Datite UTF. Changing the UNIQUAP datatine into Latin 1 improves the insertion rate from 50 inserts / sec to 1000 inserts / sec. I think that latin1-> UTF 8 Cast is a CPU killer

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -