Friday 2 September 2011

Load testing RTE–generating the load

I don’t know if I found a bug, but the SQLServer trigger for F90710 does not fire for bulk inserts.

so if you do “insert into select * from”, not all of the rows get a new unique ID and a timestamp.

So, you can use this little gem to get some records into the F90710 for load testing:

Firstly wait till there is a little bit of data in the F90710 and then execute this:

select * into testdta.F90710SRM from TESTDTA.F90710 where etevntname = 'RTSOOUT' ;

You’ll now have a copy of the F90710 without triggers.

Simply choose a record that you want to replicate in the SRM table and get it’s ETEVNTID “'E90LOG8_2181109774_6015_4284_083020111637491'”  Plug that into the yellow bit below

-- Declare an iterator
DECLARE @I INT
-- Initialize the iterator
SET @I = 1

WHILE (@I <= 500)
BEGIN

    insert into TESTDTA.F90710
    (ETEVNTID,ETEVNTSEQ,ETEVNTTIME,ETEVNTNAME,ETEVNTTYPE,ETEVNTST,ETENV,ETEVNTUSER,ETUGRP,ETOBNM,ETVER,
    ETEVNTSNS,ETEVNTSCOPE,ETEVNTHOST,ETEVNTSRT,ETEVNTBSFN,ETFCTNM,ETEVNTPRID,ETEDATA,ETPID,ETUSER,
    ETMKEY,ETUPMJ,ETUPMT)
    select
    rtrim(ETEVNTID) + convert(varchar(4),@I),ETEVNTSEQ,ETEVNTTIME,ETEVNTNAME,ETEVNTTYPE,ETEVNTST,ETENV,ETEVNTUSER,
    ETUGRP,ETOBNM,ETVER,ETEVNTSNS,ETEVNTSCOPE,ETEVNTHOST,ETEVNTSRT,ETEVNTBSFN,ETFCTNM,ETEVNTPRID,
    ETEDATA,ETPID,ETUSER,ETMKEY,ETUPMJ,ETUPMT
    from TESTDTA.F90710srm where rtrim(ETEVNTID) = 'E90LOG8_2181109774_6015_4284_083020111637491';
       
        PRINT 'Row No = ' + CONVERT(VARCHAR(4), @I)
        SET @I = @I  + 1
END

The above will place 500 rows into the table and will fire the triggers to get a proper sequence etc.

No comments: