Re: What is the quickest query in the database?

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tino Wildenhain <tino(at)wildenhain(dot)de>
Cc: P G <pg_dba(at)Yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: What is the quickest query in the database?
Date: 2003-02-20 20:00:41
Message-ID: 3E5533E9.7B6AAE83@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tino Wildenhain wrote:
>
> Hi P G,
>
> On Thu, 20 Feb 2003 09:52:07 -0800 (PST)
> P G <pg_dba(at)yahoo(dot)com> wrote:
>
> > What is the quickest and least intrusive query in the
> > database that will always succeed?
>
> select 1;

Not if you're currently in transaction aborted state.

An empty query is. In psql this can be done with just a semicolon. It
will not affect the current transaction state, it will return
PGRES_EMPTY_QUERY (IIRC) or bail out because of a lost connection. And
it doesn't even need to parse a single keyword.

Jan

>
> :o)
>
> Regards
> Tino
>
> > select current_user;
> >
> > -- OR --
> >
> > select datname from pg_database where datname =
> > 'some_database';
> >
> > Or would it be something else?
> >
> > TIA.
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Tax Center - forms, calculators, tips, more
> > http://taxes.yahoo.com/
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> > message can get through to the mailing list cleanly
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2003-02-20 20:11:26 Re: What is the quickest query in the database?
Previous Message Jonathan Bartlett 2003-02-20 19:52:31 Re: What is the quickest query in the database?