| From: | Miroslav Šulc <miroslav(dot)sulc(at)startnet(dot)cz> |
|---|---|
| To: | Kaloyan Iliev Iliev <news1(at)faith(dot)digsys(dot)bg> |
| Cc: | pgsql-performance(at)postgresql(dot)org |
| Subject: | Re: How to read query plan |
| Date: | 2005-03-14 17:07:54 |
| Message-ID: | 4235C4EA.40704@startnet.cz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers 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
| Attachment | Content-Type | Size |
|---|---|---|
| miroslav.sulc.vcf | text/x-vcard | 400 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-03-14 17:24:22 | Avoiding tuple construction/deconstruction during joining |
| Previous Message | Kaloyan Iliev Iliev | 2005-03-14 17:03:37 | Re: How to read query plan |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-03-14 17:24:22 | Avoiding tuple construction/deconstruction during joining |
| Previous Message | Kaloyan Iliev Iliev | 2005-03-14 17:03:37 | Re: How to read query plan |