Re: Why does this array query fail?

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: Why does this array query fail?
Дата
Msg-id 1379474139935-5771367.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: Why does this array query fail?  (Ken Tanzer <ken.tanzer@gmail.com>)
Ответы Re: Why does this array query fail?
Список pgsql-general
Ken Tanzer wrote
> It's probably way more detail than you want, but I've attached the table
> structure and pasted in a quarterly report that the query above was taken
> from in case you have any pointers or are simply curious.

Is this a quarterly report because that is how long it takes to run?

On a smaller scale I've written queries like this.  I enrolled in a
university database design course shortly thereafter...

I would suggest considering how to use functions to encapsulate some of the
"medical code collecting" logic.  And consider WITH/CTE constructs as well,
like I used in my last message, to effectively create temporary named tables
for different parts of the query.

Might want to move the whole thing into function and pass in the various
parameters - namely the date range - instead of hard-coding the values into
the view.

Those thoughts aside I've done my own share of "write-once, read never"
queries and if the performance meets your needs and the maintenance burden
is acceptable then sometimes you just leave this in place until someone more
knowledgeable (like a future you probably) comes back and decides to toss
and rewrite it.

David J.





--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Why-does-this-array-query-fail-tp5771165p5771367.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


В списке pgsql-general по дате отправления:

Предыдущее
От: David Johnston
Дата:
Сообщение: Re: Why does this array query fail?
Следующее
От: Albe Laurenz
Дата:
Сообщение: Re: Something Weird Going on with VACUUM ANALYZE