From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | azhwkd <azhwkd(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: query locks up when run concurrently |
Date: | 2016-11-24 17:29:25 |
Message-ID: | e95cecdd-09a1-3d48-9136-08ac0fd162cf@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 11/23/2016 10:41 PM, azhwkd wrote:
> The group ID is part of the primary key of the group_history table. My
> understanding is that two INSERTs with different group IDs should not
> collide in this case, or am I wrong in thinking this?
The suspicion is that this:
insert into group_history ("group", id, sub_category, "date", aa, ab,
bb, ba, quantity, "hour") ....
is not the problem. That this(from the trigger function) is:
execute 'INSERT INTO public.' || quote_ident(_tablename) || ' VALUES ($1.*)
on conflict ("group", id, sub_category, "when", "hour") do
....
where _tablename is:
_tablename := 'group_history_'||_startdate;
It would be nice to see the schema definitions for group_history and at
least one of the group_history_startdate tables.
>
> The table definition for group_history is the following:
>
> CREATE TABLE public.group_history (
> group int4 NOT NULL,
> id int4 NOT NULL,
> sub_category int4 NOT NULL,
> "date" date NOT NULL,
> aa int8 NOT NULL,
> ab int8 NOT NULL,
> bb int8 NOT NULL,
> ba int8 NOT NULL,
> quantity int8 NOT NULL,
> "hour" int2 NOT NULL,
> CONSTRAINT group_history_pk PRIMARY KEY (group,id,sub_category,"date","hour")
> )
> WITH (
> OIDS=FALSE
> );
>
> Kind regards,
> Sebastian
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2016-11-24 17:33:26 | Re: query locks up when run concurrently |
Previous Message | Adrian Klaver | 2016-11-24 17:20:18 | Re: query locks up when run concurrently |