Re: Default order of select datname from pg_database

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Elías David <elias(dot)moreno(dot)tec(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Default order of select datname from pg_database
Date: 2014-04-19 15:17:35
Message-ID: 24744.1397920655@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

=?UTF-8?B?RWzDrWFzIERhdmlk?= <elias(dot)moreno(dot)tec(at)gmail(dot)com> writes:
> By any change, does the following query have an "order by" by default when
> omitted?:

> select datname from pg_database;

No. No SQL query ever has a "default" order by.

> I executed that query against one of my servers and while looking at the
> names it seems complety random, the order is always the same, for instance:

An unqualified query is typically going to result in a sequential scan
of the table, so what you're seeing is the current physical order of the
tuples. This might change after adding/deleting/changing the properties
of a database.

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message David G Johnston 2014-04-19 15:44:51 Re: Default order of select datname from pg_database
Previous Message Jason Mathis 2014-04-19 14:45:50 Re: Default order of select datname from pg_database