Re: AWS forcing PG upgrade from v9.6 a disaster

Поиск
Список
Период
Сортировка
От Dean Gibson (DB Administrator)
Тема Re: AWS forcing PG upgrade from v9.6 a disaster
Дата
Msg-id 79489b9a-608e-4a96-076a-963e7217fc3c@mailpen.com
обсуждение исходный текст
Ответ на Re: AWS forcing PG upgrade from v9.6 a disaster  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: AWS forcing PG upgrade from v9.6 a disaster
Список pgsql-performance
On 2021-05-29 13:35, Andrew Dunstan wrote:
On 5/29/21 3:59 PM, Dean Gibson (DB Administrator) wrote:
Meanwhile, I've been doing some checking.  If I remove "CAST(
license_status AS CHAR ) = 'A'", the problem disappears.  Changing the
JOIN to a RIGHT JOIN, & replacing WHERE with ON, also "solves" the
problem, but there is an extra row where license_status is NULL, due
to the RIGHT JOIN.  Currently trying to figure that out (why did the
CAST ... match 'A', if it is null?)...
Why are you using this expression? It's something you almost never want
to do in my experience. Why not use the substr() function to get the
first character?

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Although it doesn't matter in this case, I do it because in general, it changes the type of the value from CHAR to bptext or whatever it is, & that has causes comparison issues in the past.  It's just a matter of habit for me when working with CHAR() types.

But this case, where it doesn't matter, I'd use LEFT().

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

Предыдущее
От: Vijaykumar Jain
Дата:
Сообщение: Re: query planner not using index, instead using squential scan
Следующее
От: Ayub Khan
Дата:
Сообщение: dexter on AWS RDS auto tune queries