Search Postgresql Archives

Re: Select max(id) causes AccessExclusiveLock?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Edson Richter <edsonrichter@xxxxxxxxxxx> writes:
> When I issue a
> select max(id) from MyTableName
> Postgres 9.2.7 is scaling a AccessExclusiveLock and causing large delays.

Really?

regression=# create table MyTableName (
regression(#    id integer not null primary key,
regression(#    seqYear char(4),
regression(#    seqCount integer);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "mytablename_pkey" for table "mytablename"
CREATE TABLE
regression=# begin;
BEGIN
regression=# select max(id) from MyTableName;
 max 
-----
    
(1 row)

regression=# select * from pg_locks;
  locktype  | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction |  pid  |      mode       | granted | fastpath 
------------+----------+----------+------+-------+------------+---------------+---------+-------+----------+--------------------+-------+-----------------+---------+----------
 relation   |    16384 |    11069 |      |       |            |               |         |       |          | 2/120853           | 12432 | AccessShareLock | t       | t
 relation   |    16384 |    42142 |      |       |            |               |         |       |          | 2/120853           | 12432 | AccessShareLock | t       | t
 relation   |    16384 |    42139 |      |       |            |               |         |       |          | 2/120853           | 12432 | AccessShareLock | t       | t
 virtualxid |          |          |      |       | 2/120853   |               |         |       |          | 2/120853           | 12432 | ExclusiveLock   | t       | t
(4 rows)

I see nothing higher than AccessShareLock on the table.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux