Skip site navigation (1) Skip section navigation (2)

Re: Question

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Chris Travers <chris(at)travelamericas(dot)com>
Cc: David Costa <geeks(at)dotgeek(dot)org>,Postgresql Advocacy <pgsql-advocacy(at)postgresql(dot)org>
Subject: Re: Question
Date: 2004-02-21 16:01:00
Message-ID: 1077379259.31467.8.camel@jester (view raw or flat)
Thread:
Lists: pgsql-advocacy
On Sat, 2004-02-21 at 06:13, Chris Travers wrote:
> On Sat, 2004-02-21 at 09:13, David Costa wrote:
> 
> > dead elephant  ;) what about a cool one line postgresql query in lieu 
> > of him ? could demonstrate the logic power of postgresql vs mysql and 
> > others
> > anyone willing to share a nice one ?
> 
> Hmmm....  Thinking of PostgreSQL vs MySQL vs. Firebird.....
> 
> Unfortunately most of my complex queries are 8-10 lines long and use
> features such as subselects and UNION statements.  Those will show the
> difference between MySQL and PostgreSQL, but should work in
> Interbase/Firebird.
> 
> I am afraid the request to demonstrate the logic power of PostgreSQL in
> one line is sort of like asking for a proof to Fermat's Theorem in one
> double-spaced page and normal font size.  If someone can do this, I will
> be quite impressed :-P

rbt=# select nspname, sum(relpages) from pg_class join pg_namespace n on
(relnamespace = n.oid) group by nspname, relnamespace having 2 > (SELECT
count(*) from pg_constraint where relnamespace = connamespace);

With some effort you might be able to get the above down to a single
line (shorter column names, etc.).

It takes the sum of pages used by relations in namespaces with a minimum
of 2 constraints.



In response to

Responses

  • Re: Question at 2004-02-21 16:10:30 from Shridhar Daithankar

pgsql-advocacy by date

Next:From: Magnus HaganderDate: 2004-02-21 16:07:05
Subject: Re: News Feed: PHP/Postgresql Advocacy
Previous:From: Robert TreatDate: 2004-02-21 14:43:19
Subject: Re: Question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group