From: | Павел Самусев <pawel(dot)samysev(at)gmail(dot)com> |
---|---|
To: | Francisco Olarte <folarte(at)peoplecall(dot)com> |
Cc: | "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #13635: Interlocks at selection with array_agg |
Date: | 2015-09-25 10:12:27 |
Message-ID: | CA+=CZ4tAgTjSFH1y9NzH9ObQREpduvTOHYfoD058gemwxKSxxg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi, we generate sql query at php. And interval not overlaps by php code:
```
<?php
$connections = [];
for($i = 0; $i < 72; $i++){
$connections[] = pg_connect("***", PGSQL_CONNECT_FORCE_NEW);
pg_query("SET application_name = 'DB.Upgrade #{$i}'");
}
$chunk = 10000;
do{
foreach($connections as $id => $connection){
if(!pg_connection_busy($connection)) {
if($result = pg_get_result($connection)){
pg_free_result($result);
}
pg_send_query($connection, strtr('
UPDATE phone p
SET mailing_id = (
SELECT array_agg(mailing_id)
FROM message m
WHERE m.phone_id = p.phone_id
)
WHERE
p.phone_id BETWEEN :min AND :max
', [
':min' => $chunk,
':max' => $chunk+9999,
]));
$chunk += 10000;
}
}
usleep(100000);
}
while(true);
```
We assume that block throw when 2 phone at 2 different query has same
mailng_id. That possible only if selection create some locks.
2015-09-24 19:43 GMT+03:00 Francisco Olarte <folarte(at)peoplecall(dot)com>:
> Hi pawel:
>
> On Thu, Sep 24, 2015 at 11:56 AM, <pawel(dot)samysev(at)gmail(dot)com> wrote:
>
> Not seeing the whole query I cannot say too much but:
>
> > WHERE
> > p.phone_id BETWEEN :min AND :max
>
> ¿ Are you sure you're not getting fencepost overlaps when substituting
> :min/:max ? ( between does closed intervals, normally half closed (
> phone_id >= min and phone_id<max ) are used for this kinds of queries
> ( I ask because it seems a query doing b-c could lock out other doing
> a-b for a long time ).
>
> Francisco Olarte.
>
--
С уважением, Павел Самусев
+ 7 (926) 66 83 137
pawel(dot)samysev(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | lei | 2015-09-25 11:23:45 | BUG #13638: Exception texts from plperl has bad encoding |
Previous Message | Aaron C. de Bruyn | 2015-09-25 04:22:47 | Re: BUG #13637: ~2 GB psql import fails with out of memory error on machine with 64 GB RAM |