Re: Mini improvement: statement_cost_limit

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Mini improvement: statement_cost_limit
Дата
Msg-id 603c8f070808151503h15263573q76c7f5f5c1239d18@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Mini improvement: statement_cost_limit  (Bruce Momjian <bruce@momjian.us>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Mini improvement: statement_cost_limit
Следующее
От: Tom Lane
Дата:
Сообщение: Misusing functions taking "internal" via coincidental signature match