pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Miroslav Šulc <miroslav.sulc@startnet.cz>
To: Kaloyan Iliev Iliev <news1@faith.digsys.bg>
Cc: pgsql-performance@postgresql.org
Subject: Re: How to read query plan
Date: Mon, 14 Mar 2005 18:07:54 +0100
Message-ID: <4235C4EA.40704@startnet.cz> (raw)
In-Reply-To: <4235C3E9.2080505@faith.digsys.bg>
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>
	<opsnmecyijth1vuj@localhost>
	<423556B8.4020500@startnet.cz>
	<14079.1110817416@sss.pgh.pa.us>
	<4235BCE8.1090705@startnet.cz>
	<4235C3E9.2080505@faith.digsys.bg>

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

Attachments:

miroslav.sulc.vcf (text/x-vcard, 401B) download begin:vcard fn;quoted-printable:Miroslav =C5=A0ulc n;quoted-printable:=C5=A0ulc;Miroslav org:StartNet s.r.o. adr;quoted-printable;quoted-printable:;;Vrchlick=C3=A9ho 161/5;Praha 5;;150 00;=C4=8Cesk=C3=A1 republika email;internet:miroslav.sulc@startnet.cz title:CEO tel;work:+420 257 225 602 tel;cell:+420 603 711 413 x-mozilla-html:TRUE url:http://www.startnet.cz version:2.1 end:vcard

view thread (37+ messages)

Message-ID: <4235C4EA.40704@startnet.cz>
Permalink:  ../4235C4EA.40704@startnet.cz/
Also on:    postgresql.org/message-id/4235C4EA.40704@startnet.cz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: miroslav.sulc@startnet.cz, news1@faith.digsys.bg
  Subject: Re: How to read query plan
  In-Reply-To: <4235C4EA.40704@startnet.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox