Re: Data access perfomance
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Sat, 27 Aug 2005 09:44:43 +0000 (UTC)
Eduardo Fonseca B. (EduardoFonsecaB@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
> Hi, thanks I kind reduce the time inserting into the database, the problem
> was that I had a primary key on the table,
> then I drop the keys and created a non clustered index, the insertion
> reduce from 20 minute to 10, and into a document that lasted 11 hours the
> time reduce to 5,
> but this had one miliion registers.
> Still I believe It's slow.
> The insert statemente looks like
> @ARE THE COMMAND REPLACED BY MY LOGIC@
> ? are the order parameters sent to the OledbParameters
>
> INSERT INTO @TABLE_NAME@(COLUMN_NAME1, COLUMN_NAME2...)
> VALUES( ?, ?...)
So far so good. You sould also use the same command object for the
same table, and only refresh the parameter values from call to call.
If you build a new command object for each row you insert, you are losing
a lot of time.
> I better don't create stored procedures, my idea with this kind of
> applications is that the database structure should not be modified, but
> thanks anyway.
A noble goal, but unfortunately it can come with a cost in performance.
> What does exactly do the Prepared() method?.
By preparing the query, and just altering the parameters, the command
is parsed and ready to use. When you do something like inserting a
million rows, this can be a big time saver. Again, this presumes that
you reuse your command object.
The exact effect of Prepare depends on the DBMS and the OLE DB provider.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
.
- Follow-Ups:
- Re: Data access perfomance
- From: Eduardo Fonseca B.
- Re: Data access perfomance
- References:
- Data access perfomance
- From: Eduardo Fonseca B.
- Re: Data access perfomance
- From: Erland Sommarskog
- Re: Data access perfomance
- From: Eduardo Fonseca B.
- Re: Data access perfomance
- From: Erland Sommarskog
- Re: Data access perfomance
- From: Erland Sommarskog
- Re: Data access perfomance
- From: Eduardo Fonseca B.
- Data access perfomance
- Prev by Date: Did DataExpert suuport to connect DataReader and Object in VS2003?
- Next by Date: Re: Data access perfomance
- Previous by thread: Re: Data access perfomance
- Next by thread: Re: Data access perfomance
- Index(es):
Relevant Pages
|