Şöyle yaparız
CREATE PROCEDURE insert_address_data(recs INTEGER) LANGUAGE plpgsql AS $$ DECLARE address_id VARCHAR; address_city VARCHAR; address_state VARCHAR; BEGIN for i in 1..recs LOOP SELECT CONCAT('id0000-1234545-98756453-00' ,i) INTO address_id; SELECT CONCAT('city_' ,i) INTO address_city; SELECT CONCAT('state_' ,i) INTO address_state; INSERT INTO address (id, city, state) VALUES (address_id, address_city, address_state); IF i % 10000 = 0 THEN COMMIT; END IF; END LOOP; END $$; -- -- INSERT 100K records in each table. Record the time from pgAdmin CALL insert_books_data(100000); CALL insert_employees_data(100000); CALL insert_employees_data(100000);
Hiç yorum yok:
Yorum Gönder