pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedWhat is the fastest null WHERE
5+ messages / 4 participants
[nested] [flat]
* What is the fastest null WHERE
@ 2003-10-01 12:11 Mindaugas Riauba <mind@bi.lt>
2003-10-01 12:32 ` Re: What is the fastest null WHERE Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
2003-10-01 12:39 ` Re: What is the fastest null WHERE Richard Huxton <dev@archonet.com>
2003-10-01 12:51 ` Re: What is the fastest null WHERE Rod Taylor <rbt@rbt.ca>
0 siblings, 3 replies; 5+ messages in thread
From: Mindaugas Riauba @ 2003-10-01 12:11 UTC (permalink / raw)
To: pgsql-performance
Hello,
While writing web application I found that it would
be very nice for me to have "null" WHERE clause. Like
WHERE 1=1. Then it is easy to concat additional
conditions just using $query . " AND col=false" syntax.
But which of the possible "null" clauses is the fastest
one?
Thanks,
Mindaugas
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: What is the fastest null WHERE
2003-10-01 12:11 What is the fastest null WHERE Mindaugas Riauba <mind@bi.lt>
@ 2003-10-01 12:32 ` Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
2 siblings, 0 replies; 5+ messages in thread
From: Shridhar Daithankar @ 2003-10-01 12:32 UTC (permalink / raw)
To: Mindaugas Riauba <mind@bi.lt>; +Cc: pgsql-performance
Mindaugas Riauba wrote:
> Hello,
>
> While writing web application I found that it would
> be very nice for me to have "null" WHERE clause. Like
> WHERE 1=1. Then it is easy to concat additional
> conditions just using $query . " AND col=false" syntax.
>
> But which of the possible "null" clauses is the fastest
> one?
Rather than this approach, keep a flag which tells you whether or not it is
first where condition. If it is not first where condition, add a 'and'. That
would be simple, isn't it?
Shridhar
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: What is the fastest null WHERE
2003-10-01 12:11 What is the fastest null WHERE Mindaugas Riauba <mind@bi.lt>
@ 2003-10-01 12:39 ` Richard Huxton <dev@archonet.com>
2003-10-01 13:05 ` Re: What is the fastest null WHERE Mindaugas Riauba <mind@bi.lt>
2 siblings, 1 reply; 5+ messages in thread
From: Richard Huxton @ 2003-10-01 12:39 UTC (permalink / raw)
To: Mindaugas Riauba <mind@bi.lt>; pgsql-performance
On Wednesday 01 October 2003 13:11, Mindaugas Riauba wrote:
> Hello,
>
> While writing web application I found that it would
> be very nice for me to have "null" WHERE clause. Like
> WHERE 1=1. Then it is easy to concat additional
> conditions just using $query . " AND col=false" syntax.
>
> But which of the possible "null" clauses is the fastest
> one?
I suspect WHERE true, but is it really necessary.
Most languages will have a join() operator that lets you do something like:
$where_cond = join(' AND ', @list_of_tests)
--
Richard Huxton
Archonet Ltd
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: What is the fastest null WHERE
2003-10-01 12:11 What is the fastest null WHERE Mindaugas Riauba <mind@bi.lt>
2003-10-01 12:39 ` Re: What is the fastest null WHERE Richard Huxton <dev@archonet.com>
@ 2003-10-01 13:05 ` Mindaugas Riauba <mind@bi.lt>
0 siblings, 0 replies; 5+ messages in thread
From: Mindaugas Riauba @ 2003-10-01 13:05 UTC (permalink / raw)
To: pgsql-performance
> > While writing web application I found that it would
> > be very nice for me to have "null" WHERE clause. Like
> > WHERE 1=1. Then it is easy to concat additional
> > conditions just using $query . " AND col=false" syntax.
> >
> > But which of the possible "null" clauses is the fastest
> > one?
>
> I suspect WHERE true, but is it really necessary.
Thanks. I'll use "WHERE true" for now. And of course it is
not necessary it just simplifies code a bit.
> Most languages will have a join() operator that lets you do something
like:
>
> $where_cond = join(' AND ', @list_of_tests)
That's not the case. Test may or may not be performed based on
web form values.
Mindaugas
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: What is the fastest null WHERE
2003-10-01 12:11 What is the fastest null WHERE Mindaugas Riauba <mind@bi.lt>
@ 2003-10-01 12:51 ` Rod Taylor <rbt@rbt.ca>
2 siblings, 0 replies; 5+ messages in thread
From: Rod Taylor @ 2003-10-01 12:51 UTC (permalink / raw)
To: Mindaugas Riauba <mind@bi.lt>; +Cc: pgsql-performance
On Wed, 2003-10-01 at 08:11, Mindaugas Riauba wrote:
> While writing web application I found that it would
> be very nice for me to have "null" WHERE clause. Like
> WHERE 1=1. Then it is easy to concat additional
> conditions just using $query . " AND col=false" syntax.
>
> But which of the possible "null" clauses is the fastest
> one?
WHERE true AND ....
Attachments:
signature.asc (application/pgp-signature, 186B) download
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2003-10-01 13:05 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-01 12:11 What is the fastest null WHERE Mindaugas Riauba <mind@bi.lt>
2003-10-01 12:32 ` Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
2003-10-01 12:39 ` Richard Huxton <dev@archonet.com>
2003-10-01 13:05 ` Mindaugas Riauba <mind@bi.lt>
2003-10-01 12:51 ` Rod Taylor <rbt@rbt.ca>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox