X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 841AA567AF for ; Mon, 14 Mar 2005 17:08:11 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88395-10 for ; Mon, 14 Mar 2005 17:08:01 +0000 (GMT) Received: from sranda.klamovka.kosire.czf (unknown [82.113.63.66]) by svr1.postgresql.org (Postfix) with ESMTP id A764655F51 for ; Mon, 14 Mar 2005 17:07:58 +0000 (GMT) Received: (qmail 9464 invoked from network); 14 Mar 2005 18:07:55 +0100 Received: from startnet.klamovka.kosire.czf (HELO ?192.168.11.101?) (10.15.6.17) by mail.klamovka.kosire.czf with AES256-SHA encrypted SMTP; 14 Mar 2005 18:07:55 +0100 Message-ID: <4235C4EA.40704@startnet.cz> Date: Mon, 14 Mar 2005 18:07:54 +0100 From: =?UTF-8?B?TWlyb3NsYXYgxaB1bGM=?= Organization: StartNet s.r.o. User-Agent: Mozilla Thunderbird 1.0 (X11/20041208) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kaloyan Iliev Iliev Cc: pgsql-performance@postgresql.org Subject: Re: How to read query plan References: <42345D24.8070104@startnet.cz> <4234692E.3050802@arbash-meinel.com> <42347407.2000202@startnet.cz> <42347D5E.9000900@arbash-meinel.com> <42348F54.1000408@startnet.cz> <423493E5.6040203@arbash-meinel.com> <42355249.8090101@startnet.cz> <423556B8.4020500@startnet.cz> <14079.1110817416@sss.pgh.pa.us> <4235BCE8.1090705@startnet.cz> <4235C3E9.2080505@faith.digsys.bg> In-Reply-To: <4235C3E9.2080505@faith.digsys.bg> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/mixed; boundary="------------070209000404000505020609" X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200503/270 X-Sequence-Number: 10975 This is a multi-part message in MIME format. --------------070209000404000505020609 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 --------------070209000404000505020609 Content-Type: text/x-vcard; charset=utf-8; name="miroslav.sulc.vcf" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="miroslav.sulc.vcf" YmVnaW46dmNhcmQNCmZuO3F1b3RlZC1wcmludGFibGU6TWlyb3NsYXYgPUM1PUEwdWxjDQpu O3F1b3RlZC1wcmludGFibGU6PUM1PUEwdWxjO01pcm9zbGF2DQpvcmc6U3RhcnROZXQgcy5y Lm8uDQphZHI7cXVvdGVkLXByaW50YWJsZTtxdW90ZWQtcHJpbnRhYmxlOjs7VnJjaGxpY2s9 QzM9QTlobyAxNjEvNTtQcmFoYSA1OzsxNTAgMDA7PUM0PThDZXNrPUMzPUExIHJlcHVibGlr YQ0KZW1haWw7aW50ZXJuZXQ6bWlyb3NsYXYuc3VsY0BzdGFydG5ldC5jeg0KdGl0bGU6Q0VP DQp0ZWw7d29yazorNDIwIDI1NyAyMjUgNjAyDQp0ZWw7Y2VsbDorNDIwIDYwMyA3MTEgNDEz DQp4LW1vemlsbGEtaHRtbDpUUlVFDQp1cmw6aHR0cDovL3d3dy5zdGFydG5ldC5jeg0KdmVy c2lvbjoyLjENCmVuZDp2Y2FyZA0KDQo= --------------070209000404000505020609--