On Thu, 2009-03-26 at 00:17 -0700, Szymon wrote:
> On 25 Mar, 21:15, Antoni Aloy <antoni.a...@gmail.com> wrote:
> > The obvious one: check your cron job .. Log your queries in postgres
> > to see which querie consumes more time, it should be the cron job one.
> 
> I did it some time ago, and there are such entries:
> 
> Mar 20 18:12:20 ns204293 postgres[27213]: [3-1] [27213]LOG:  process
> 27213 acquired ExclusiveLock on tuple (21,19) of relation 197227 of
> database 98304 after 42887.468 ms
> 
> Question is - should Django ever do a ExclusiveLock?

The question doesn't quite make sense, since there are multiple types of
exclusive locks in PostgreSQL (ROW EXCLUSIVE, ACCESS EXCLUSIVE and
EXCLUSIVE).

Firstly, though, Django never explicitly asks for any kind of lock. The
only communication it has with the database is via SELECT, INSERT, and
UPDATE statements (along with starting and committing transactions).

I can't tell from that log output fragment what type of lock is really
being talked about there. It's probably better to try and catch things
in the act and look at the pg_locks table, which has a lot more
information.

Even so, it's possible that a row-level lock could be held for the
duration of a transaction that updated that row. So does your cronjob
run as a single long-running transaction? If so, this could well be
"situation normal".

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to