Re: Memory problem - writing to database
From: Paul fpvt2 (anonymous_at_discussions.microsoft.com)
Date: 12/25/04
- Next message: Les: "Re: Lines in a Rich Text Box"
- Previous message: Rick Rothstein: "Re: Lines in a Rich Text Box"
- In reply to: Bonj: "Re: Memory problem - writing to database"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 24 Dec 2004 21:55:42 -0800
Thank you for your reply.
>I don't know whether you have gone with keeping a
>connection open to execute your SP on, or opening and
>closing them, but it seems like you have got it
>sorted.
Currently, I have the connection open in the beginning of
the program and leave it open. I will try it with opening
and closing them as data comes in.
>But I think it was the recordset that was causing you so
>much grief.
Yes, it was the recordset, because now the memory usage
stays the same and it does not increase.
Thank you very much.
>-----Original Message-----
>When I say open a connection every time and close it
when you are done with
>it, I meant you to do this *aswell as* Brian's idea of
using an SP, not
>instead of.
>I don't know whether you have gone with keeping a
connection open to execute
>your SP on, or opening and closing them, but it seems
like you have got it
>sorted.
>But I think it was the recordset that was causing you so
much grief. I
>always tend to shy away from dynamic updateable
recordsets, especially when
>they're got from a "select" statement rather than table-
direct. The SP makes
>sense though as it means SQL server doesn't have to keep
parsing INSERT
>statements, which offers much more of a performance gain
in this situation
>where you have a lot of frequent operations as opposed
to one long one.
>
>"Paul fpvt2" <Paulfpvt2@discussions.microsoft.com> wrote
in message
>news:6E76464C-E175-4F76-B4CF-
8A75B0E0E562@microsoft.com...
>> Thank you.
>>>which is to open a new connection for every new piece
of
>>> data, and importantly, make sure you close it as soon
as the data is
>>> inserted.
>> Does not opening and closing db connection slow down
the program ? Does it
>> take a lot of resource to keep opening and closing the
db connection ?
>>
>> "Bonj" wrote:
>>
>>> > If I do not have the recordset open all the time, I
will need to query
>>> > the
>>> > database again to add a new record. I do not want
to do this, because
>>> > it
>>> > will
>>> > take a long time to query the database (the db can
have up to 10
>>> > million
>>> > records).
>>>
>>> Don't use a recordset to add new data. Instead, fire
off an "INSERT"
>>> statement.
>>>
>>> > I have to keep the connection open all the time also
>>>
>>> You don't.
>>>
>>> > , because data is coming
>>> > in every milliseconds, and as the data comes in, I
need to write all of
>>> > them
>>> > to the database.
>>>
>>> Try my suggestion - which is to open a new connection
for every new piece
>>> of
>>> data, and importantly, make sure you close it as soon
as the data is
>>> inserted. The connection should be opened as late as
possible and closed
>>> as
>>> soon as possible.
>>>
>>>
>>>
>
>
>.
>
- Next message: Les: "Re: Lines in a Rich Text Box"
- Previous message: Rick Rothstein: "Re: Lines in a Rich Text Box"
- In reply to: Bonj: "Re: Memory problem - writing to database"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|