From: Gyozo Papp <pgerzson@freestart.hu>
To: Jesus Aneiros <aneiros@ucfinfo.ucf.edu.cu>
Cc: pgsql-php@postgresql.org
Subject: Re: psql with PHP question
Date: Sat, 5 May 2001 15:45:51 +0200
Message-ID: <01b001c0d569$b3513560$4647c5d5@jaguar> (raw)
References: <Pine.LNX.4.10.10105050824290.16295-100000@ucfinfo.ucf.edu.cu>
Hello,
just some more word :
> > In my opinion, these queries make the same :
> > SELECT id FROM article WHERE id=(SELECT MAX(id) FROM article);
> > SELECT MAX(id) FROM article;
> >
> > but the latter one is much more simple and you do not overload your pg.
> > (by the way, I think id = (SELECT ...) isn't handled gracefully.)
>
> Hi, although I agreee with the first part: the subselect is redundat in
> this case, I don't understand de second one. The subselect will return one
> value, or am I wrong? So, I think the operator = will be correct, or not?
I mean the second sentence that I don't think the planner/optimizer is so clever to reduce the former query to the latter one.
You're right the sublselect will return one value, but as far as I know this value should be interpreted as a set of one value (because of the select).
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: pgerzson@freestart.hu, aneiros@ucfinfo.ucf.edu.cu
Subject: Re: psql with PHP question
In-Reply-To: <01b001c0d569$b3513560$4647c5d5@jaguar>
References: <Pine.LNX.4.10.10105050824290.16295-100000@ucfinfo.ucf.edu.cu> <01b001c0d569$b3513560$4647c5d5@jaguar>
* 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