Re: What is the fastest way to add a large number of records ?

From: Viatcheslav V. Vassiliev (support_at_oledbdirect.com)
Date: 01/29/04


Date: Thu, 29 Jan 2004 21:29:51 +0300

Try open recordset with server-side cursor and append rows without SQL - on
both MS SQL Server and MS Access this should be faster. This will not slow
down even on large datasets - server-side cursor does not cache rows. Do not
forget to call DisableControls()\EnableControls() even if you have no
controls attached. For MS Access doing inserts inside transaction could give
you additional speed up.

If you still need speed improvement, on MS SQL Server the fastest inserts
are done with bulk-copy rowsets. This feature is available only in MS SQL
Server OLEDB provider and is not accessible from ADO. With OLEDB Direct
(http://www.oledbdirect.com) you will be able to use this interface and
insert up to 100 000 records per sec.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Andrew Cutforth" <ajcs@ukgo.com> сообщил/сообщила в новостях следующее:
news:401934b4$1@newsgroups.borland.com...
> When importing data I am adding a large number of records (many thousands)
> into a database via ADO. The database could be Access or MS SQL Server.
>
> Using a TADOQuery there are two methods I know to add a record:
> 1. Send a SQL insert command. I speeded this up by doing: ExecuteOptions
:=
> ExecuteOptions + [eoExecuteNoRecords];
> 2. Open a live empty dataset and append to it. This method I found to be
> the quickest on a small set of data but my guess is that with large data
it
> would slow down and use huge resources due to keeping a large dataset
open.
>
> Does anyone have any advice on the fastest way to do this ? I appritiate
I
> might not be able to do it the same way on Access and SQL Server.
>
> Thanks
>
> --
> Andrew Cutforth
> Author of AJC Directory Synchronizer: Directory Compare & Synchronize
> www.ajcsoft.com
>
>



Relevant Pages

  • Re: Attempt to initiate a new SQL Server operation with results pending.
    ... >your example code will not work unless you force a server-side cursor (see ... >I would seriously suggest you try and avoid multiple active statements - there ... be mortified, but I don't have too much to do with SQL server, so I'll ... just create lots of $dbh things and ->finish all the statements and hope ...
    (perl.dbi.users)
  • Re: Cannot insert or update columns from multiple tables (post #2) Need help please
    ... Provider for SQL Server) to update records from a dataset on a multi-tables ... I am using a server-side cursor ... But if I change the SQL driver to use an ODBD DataSource (Microsoft OLE DB ... Provider for ODBC Driver), is it working. ...
    (borland.public.delphi.database.ado)
  • Re: TADOQuery slow inserts in Oracle
    ... Use server-side cursor - you do not need row cache if you do only inserts on ... http://www.oledbdirect.com - The fastest way to access MS SQL Server, ... > I've used ADO before with Oracle, but never had such slow effects as I'm ... What can I do with my TADOQuery to speed up the .Post? ...
    (borland.public.delphi.database.ado)
  • Re: Any chance to replace the Seek method by converting from DAO to ADO ?
    ... I am trying to port a VB -Access-DAO application to a SQL Server 2K-ADO ... Is there any chance to replace the DAO Seek method with a SQL-Server 2K ADO ... the Recordset Open statement in addition to using a server-side cursor. ...
    (microsoft.public.vb.database.ado)
  • Re: Parameters Question
    ... OleDB the syntax for calling a stored procedure is the same as the ODBC ... The .NET Framework Data Provider for SQL Server does not support the ... In this case, you must use named parameters, as in the ...
    (microsoft.public.dotnet.framework.adonet)