Skip site navigation (1) Skip section navigation (2)

Re: gprof SELECT COUNT(*) results

From: simon(at)2ndquadrant(dot)com
To: <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: gprof SELECT COUNT(*) results
Date: 2005-11-29 10:04:23
Message-ID: 5012613.67541133258663901.JavaMail.servlet@kundenserver (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
>> > OTOH DB2 and SQLServer take block level 
>> > read locks, so they can do this too, but at major loss of
>> > and threat of deadlock.
>Note, that in the usual committed read isolation, they do not need to 
>read lock a row ! e.g. Informix only verifies, that it could lock the
>(that there is no write lock). Only cursor stability leaves one read
>until the next fetch, serializable actually leaves all read locks, 
>and select for update an intent update lock.

Not sure which product you're thinking about there. No such isolation level in DB2 or SQLServer, AFAIK. Were you talking about just Informix?

Uncommitted Read (UR) mode "Dirty read" isn't the default, or the recommended lock level for most apps. I was considering Cursor Stability mode (or higher), which is the default unless you specifically set the system default otherwise. You can always skip the deadlock threat by using Uncommitted Read, by risking getting wrong results. There isn't anything there I would ever want to emulate.

READ COMMITTED does take share locks. There's a NO LOCK hint, true, but its not a default. READ_COMITTED_SNAPSHOT, new in 2005, does row versioning like Oracle/PostgreSQL, and doesn't take locks. 

Out of interest:

DB2 has learned from PostgreSQL that its OK to read a row and check whether it can see it before worrying about locks. The recently introduced DB2_EVALUNCOMMITTED and DB2_SKIPINSERTED flags provide PostgreSQL like behaviour, new in the very latest release.

Best Regards, Simon Riggs

pgsql-hackers by date

Next:From: Martijn van OosterhoutDate: 2005-11-29 11:02:22
Subject: Re: ice-broker scan thread
Previous:From: Mario WeilguniDate: 2005-11-29 09:05:14
Subject: Re: Hashjoin startup strategy (was Re: Getting different number of results when using hashjoin on/off)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group