I'm working with a C# .NET 4.0 application, that uses ODP.NET 11.2.0.2.0 with an Oracle 11g database. The application pre-loads a few look-up tables with data, and since most have less than 20 records, the scripts run pretty quickly. However, one of the scripts has 802 records, and takes 248.671 seconds to insert the records, which seems excessive for such a small amount of data with a database that advertises fast operations with large volumes of data.
So I'm wondering, is there a faster way to insert data, via script, than the current way the script is written?
The table being inserted into is defined like so:
CREATE TABLE FileIds
(
Id NUMERIC(38) NOT NULL
,Name NVARCHAR2(50) DEFAULT 'Unknown' NOT NULL
,FileTypeGroupId NUMERIC(38) NOT NULL
,CONSTRAINT FK_FileIds_FileTypeGroups FOREIGN KEY ( FileTypeGroupId ) REFERENCES FileTypeGroups ( Id )
)
And the script to insert looks like the following:
BEGIN
INSERT ALL
INTO FileIds ( Id, FileTypeGroupId ) VALUES (1152,5)
INTO FileIds ( Id, FileTypeGroupId ) VALUES (1197,10)
INTO FileIds ( Id, FileTypeGroupId ) VALUES (1200,6)
INTO FileIds ( Id, FileTypeGroupId ) VALUES (1143,3)
INTO FileIds ( Id, FileTypeGroupId ) VALUES (1189,9)
INTO FileIds ( Id, FileTypeGroupId ) VALUES (1109,7)
INTO FileIds ( Id, FileTypeGroupId ) VALUES (1166,4)
INTO FileIds ( Id, FileTypeGroupId ) VALUES (0,8)
INTO FileIds ( Id, FileTypeGroupId ) VALUES (1149,2)
INTO FileIds ( Id, FileTypeGroupId ) VALUES (1400,1)
INTO FileIds ( Id, FileTypeGroupId ) VALUES (1330,11)
INTO FileIds ( Id, FileTypeGroupId ) VALUES (1000,0)
-- 790 Records removed for example purposes.
SELECT * FROM DUAL;
COMMIT;
END;
The FileTypeGroups table, referenced in the Foreign Key, is pre-loaded prior to the loading of the FileIds table. There are no sequences or triggers associated with the FileIds table, and as of yet indexes have not been created for the table.