Re: Why does this SQL work?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Anil Menon <gakmenon(at)gmail(dot)com>
Cc: Victor Yegorov <vyegorov(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why does this SQL work?
Date: 2015-05-12 08:42:53
Message-ID: 20150512084253.GA21806@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 12, 2015 at 04:07:52PM +0800, Anil Menon wrote:
> Thank you very much - looks like I will have to prefix all cols.

You should anyway.
Queries with unaliased columns make it impossible to analyze without
in-depth knowledge of the database.

Consider:

select c1, c2, c3, c4, c5
from t1 join t2 using (c6)
where c7 = 'a' and c8 < now() and c9;

which fields belong to which tables? what indexes make sense? it's
impossible to tell. if the column references were prefixed with table
name/alias - it would become possible, and easy, even, to figure out
what's going on.

depesz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Wayne E. Seguin 2015-05-12 13:50:20 Re: [BDR] Node Join Question
Previous Message Craig Ringer 2015-05-12 08:31:00 Re: [BDR] Node Join Question