Avoiding duplication of code via views -- slower? How do people typically do this?
От
Joe Van Dyk
Тема
Avoiding duplication of code via views -- slower? How do people
typically do this?
Дата
Msg-id
CACfv+pJqL-=gY=dfhXG2DVxAiPLHUbGiySv_cbTAS9kTx3fZ5g@mail.gmail.com
Список
Дерево обсуждения
Avoiding duplication of code via views -- slower? How do people
typically do this? Joe Van Dyk <joe@tanga.com>
Re: Avoiding duplication of code via views -- slower? How
do people typically do this? Jack Christensen <jack@jackchristensen.com>
Re: Avoiding duplication of code via views -- slower? How
do people typically do this? Joe Van Dyk <joe@tanga.com>
Re: Avoiding duplication of code via views -- slower? How do people typically do this? Tom Lane <tgl@sss.pgh.pa.us>
Re: Avoiding duplication of code via views -- slower? How
do people typically do this? Joe Van Dyk <joe@tanga.com>
Re: Avoiding duplication of code via views -- slower? How do people typically do this? Tom Lane <tgl@sss.pgh.pa.us>
Re: Avoiding duplication of code via views -- slower? How
do people typically do this? Jack Christensen <jack@jackchristensen.com>
Re: Avoiding duplication of code via views -- slower? How
do people typically do this? Chris Travers <chris.travers@gmail.com>
Re: Avoiding duplication of code via views -- slower? How
do people typically do this? Merlin Moncure <mmoncure@gmail.com>
See https://gist.github.com/joevandyk/4957646/raw/86d55472ff8b5a4a6740d9c673d18a7005738467/gistfile1.txtfor the code. I have promotions(id, end_at, quantity) and promotion_usages(promotion_id). I have a couple of things I typically want to retrieve, and I'd like those things to be composable. In this case, finding recently-expired promotions, finding promotions that have a quantity of one, and finding promotions that were used. My approach is to put these conditions into views, then I can join against each one. But that approach is much slower than inlining all the code. How is this typically done? Thanks, Joe
В списке pgsql-general по дате отправления
От: Cochise Ruhulessin
Дата: