Re: How to read query plan
| От | Miroslav Šulc |
|---|---|
| Тема | Re: How to read query plan |
| Дата | |
| Msg-id | 4235C4EA.40704@startnet.cz обсуждение исходный текст |
| Ответ на | Re: How to read query plan (Kaloyan Iliev Iliev <news1@faith.digsys.bg>) |
| Список | pgsql-performance |
Kaloyan Iliev Iliev wrote: > Hi, > > I have an idea about your problem. Will it be difficult not to change > the entire code but only the queries? You can change type in the > Postgres to bool. Then, when select data you can use a CASE..WHEN to > return 'Y' or 'N' or even write a little function which accepts bool > and returns 'Y' or 'N'. In this case in all your queries you will have > to replace the select of bool field with select form the function. Thank you for your suggestion. I had a private message exchange with Harald Fuchs who suggested the same (except the function). Here is what whe "exchanged": Harald Fuchs wrote: > If you can control the SELECTs, just use > > SELECT CASE col WHEN true THEN 'Y' ELSE 'N' END > > instead of > > SELECT col > > Thus you wouldn't need to change your application code. > > I use single SELECT for both PostgreSQL and MySQL. I could use your solution. It would just require some tagging of bool fields in SELECTs so I could add the CASE statement in case I use PostgreSQL backend. Miroslav
Вложения
В списке pgsql-performance по дате отправления: