From: | P G <pg_dba(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: What is the quickest query in the database? |
Date: | 2003-02-20 20:32:27 |
Message-ID: | 20030220203227.48628.qmail@web13310.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
You are correct Steve Crawford. The query is used to
remotely test the connection to the db using JDBC. I
think, though, Jan Wieck provides the most valuable
solution so far. Any more thoughts, anyone?
TIA.
--- Steve Crawford <scrawford(at)pinpointresearch(dot)com>
wrote:
> It's academic. Set timing on in psql and run a bunch
> of tests. The variation
> from test to test is large enough to mask any
> difference between select 0 or
> select '' or select null.
>
> It would, however, be nice to know the reason for
> this query. I suspect it is
> to "ping" the server and making sure it is up by
> connecting and running a
> simple query with a known result. (Many colos have
> all sorts of setups for
> monitoring web servers but fewer for other services
> - setting up a "test"
> page on the web server that makes a request from the
> app server which, in
> turn, does a simple db query, all of which
> ultimately returns a standard
> string, say "system up", to the http request works
> quite well to set off
> alarm bells at the colo or even to allow a load
> balancer to take action).
>
> But I am surmising. What is the real reason for the
> query?
>
> Cheers,
> Steve
>
>
> On Thursday 20 February 2003 11:52 am, Jonathan
> Bartlett wrote:
> > Might select NULL; be faster, since the number
> doesn't have to be parsed,
> > and null is probably a keyword?
> >
> > Jon
> >
> > On Thu, 20 Feb 2003, 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;
> > >
> > > :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
> >
> > ---------------------------(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
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2003-02-20 20:35:48 | Re: Postgres Error |
Previous Message | Dwayne Miller | 2003-02-20 20:27:54 | Search for sample pg stored procedure |