> It is not a batch update right - u are updating a single banner by id
(most
> probably cluster index right?)
>
> So why would there be so much locking?
it's not the amount of locking, you can create a deadlock with 1
row lock already. THe problem is this:
- session X starts transaction, does some updates to rows A, B and C. Calls
method M
- in M, a new session, Y, is started to read some rows, and A matches the
predicates. As X has still not completed the transaction, the row A is
locked, and as Y uses a new connection, it has to wait till the lock is
lifted, but that's going to happen after M is done, but that won't happen as
it is waiting for its caller. -> deadlock.
FB
>
> Anyway since it is an increment, can't you just increment the #hits in
some
> cache.
>
> hits[bannerid] += 1 (maybe interlocked increment)
>
> and do a single hit to db after say 1000 hits? ("update banner set
> impression = impression + ? were id = ?", 1000, 1)
>
> Ajai
>
>
> On Wed, Sep 1, 2010 at 8:59 AM, fknebels <[email protected]> wrote:
>
>
> Do you need to do an update at all or can you re-write the process
as
> inserts.
>
> If you separate out the Impressions to it's own table.
>
> Then when you are querying the data just group by the bannerid to
get
> your statistics/
>
> Would that work for you. Then you aren't locking any rows on the
> write because you are always writing a new row.
>
>
>
> On Sep 1, 8:21 am, Craig van Nieuwkerk <[email protected]> wrote:
> > I do use session per request but the updates are currently being
> done
> > in a queue which has it's own session. The isolation level is
> > IsolationLevel.ReadUncommitted.
> >
> > To possibly clarify the issue, imagine throwing 100 updates at the
> > database from 10 different requests in the space of a few seconds.
> > Deadlocks are frequent.
> >
> > On Wed, Sep 1, 2010 at 10:14 PM, José F. Romaniello
> >
>
> > <[email protected]> wrote:
> > > are you runing this command on a session per request?
> > > what is the transaction scope ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]
> <mailto:nhusers%[email protected]> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.