Re: psql with PHP question

From: "Gyozo Papp" <pgerzson(at)freestart(dot)hu>
To: "Jesus Aneiros" <aneiros(at)ucfinfo(dot)ucf(dot)edu(dot)cu>
Cc: <pgsql-php(at)postgresql(dot)org>
Subject: Re: psql with PHP question
Date: 2001-05-05 13:45:51
Message-ID: 01b001c0d569$b3513560$4647c5d5@jaguar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice pgsql-php

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).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Witold Rak 2001-05-05 13:58:24 How tnaslate kode from MySQL to Postgres?
Previous Message Christian Marschalek 2001-05-05 13:15:15 RE: [ADMIN] Primary Keys

Browse pgsql-novice by date

  From Date Subject
Next Message tompoe 2001-05-06 16:28:18 Did I fiddle too much with install?
Previous Message Jesus Aneiros 2001-05-05 12:28:36 Re: psql with PHP question

Browse pgsql-php by date

  From Date Subject
Next Message Christian Marschalek 2001-05-05 15:40:47 RE: PHP calling PHP?
Previous Message Gyozo Papp 2001-05-05 13:32:56 Re: PHP calling PHP?