Re: Mini improvement: statement_cost_limit - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Mini improvement: statement_cost_limit
Date
Msg-id 603c8f070808151503h15263573q76c7f5f5c1239d18@mail.gmail.com
Whole thread Raw
In response to Re: Mini improvement: statement_cost_limit  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
> My point is that people should _know_ they are using a cartesian
> product, and a warning would do that for users who have no need for a
> cartesian product and want to be warned about a possible error.

I think Cartesian products are a red herring.  Cartesian products are
primarily bad if they generate bad performance, and bad performance
can be generated without Cartesian products.  I've certainly written
them intentionally, from time to time.  The bigger issue is - if you
start critiquing people's query-writing, where will you stop?

SELECT * FROM foo WHERE a = NULL
WARNING: a = NULL is always false.  Did you mean id IS NULL?

SELECT * FROM foo LEFT JOIN bar ON foo.a = bar.a LEFT JOIN baz ON
foo.b = bar.b AND foo.c = baz.c
WARNING: Maybe you meant foo.b = baz.b instead of foo.b = bar.b?

I'm sure there are a hundred others - these just happen to be a few of
my old mistakes (the first one was generated by some buggy Perl
code... the second by poor cut-and-paste skills).  In any event, I
don't think it's the job of the database to argue with you about
whether you really want the data you asked for - it's job is just to
get you that data.  Of course if doing so will take longer than the
amount of time remaining before the heat death of the universe, a
warning might be appropriate.

...Robert


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Mini improvement: statement_cost_limit
Next
From: Tom Lane
Date:
Subject: Misusing functions taking "internal" via coincidental signature match