Re: BUG #13635: Interlocks at selection with array_agg

Поиск
Список
Период
Сортировка
От Павел Самусев
Тема Re: BUG #13635: Interlocks at selection with array_agg
Дата
Msg-id CA+=CZ4tAgTjSFH1y9NzH9ObQREpduvTOHYfoD058gemwxKSxxg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #13635: Interlocks at selection with array_agg  (Francisco Olarte <folarte@peoplecall.com>)
Список 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@peoplecall.com>:
Hi pawel:

On Thu, Sep 24, 2015 at 11:56 AM,  <pawel.samysev@gmail.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.samysev@gmail.com

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: BUG #13636: psql numericlocale adds comma where it ought not
Следующее
От: lei@aswsyst.cz
Дата:
Сообщение: BUG #13638: Exception texts from plperl has bad encoding