[GENERAL] Problems with Greatest
От | Teddy Schmitz |
---|---|
Тема | [GENERAL] Problems with Greatest |
Дата | |
Msg-id | SINPR0101MB1694638AB27175EAAC4F106E835A0@SINPR0101MB1694.apcprd01.prod.exchangelabs.com обсуждение исходный текст |
Ответы |
Re: [GENERAL] Problems with Greatest
[GENERAL] Problems with Greatest |
Список | pgsql-general |
Hello,
I have a query using Greatest that hangs and never returns when called with two tables.
Postgres Version: 9.6
Tables
t1{ id bigint }
t2 { id bigint }
they are sharing a sequence
the query
select greatest(max(t1.id), max(t2.id)) from t1, t2;
The purpose was to call setval on the sequence after doing a bulk data load into the database. But this query never returns. I have tried it with various combinations,
select greatest(max(t1.id), 6) from t1; -> This returns
select greatest(max(t1.id), 6) from t1, t2; -> This never returns.
The query does work if there is only a few hundred items between the tables but I'm importing about ~300,000 rows between the two tables. I looked at pg_stat_activity and it says the query is active
I worked around this problem using a union all query but I'm wondering if this is a bug or I am just using greatest wrong.
В списке pgsql-general по дате отправления: