Re: Performance of outer joins?
| От | macgillivary |
|---|---|
| Тема | Re: Performance of outer joins? |
| Дата | |
| Msg-id | 1166364857.376420.26020@16g2000cwy.googlegroups.com обсуждение исходный текст |
| Ответ на | Performance of outer joins? (Benjamin Smith <ben@schoolpathways.com>) |
| Список | pgsql-general |
ben would something like this work in your situation?
SELECT customer.id, customer.name, deliveries.calendar_day,
deliveries.delivered
FROM ben_customers as customer, ben_deliveries as deliveries
WHERE customer.id = deliveries.customers_id
and deliveries.calendar_day in (Select day
from ben_calendar
where day < 20061201 and day >= 20060101)
I think that would cut down the deliveries table fairly quickly, thus
making the customer_id join nice and quick. You would also only be
returning data from the tables in your from clause. I suppose it
depends on what you are trying to display. If you want a list of all
the possible days, and deliveries on those days then I'd approach it a
bit differently.
On Dec 15, 7:59 pm, b...@schoolpathways.com (Benjamin Smith) wrote:
>
> What can I do to improve the performance of this oft-used query? Is there a
> better way to do this, or am I doomed to looping thru results and parsing the
> results in code?
>
В списке pgsql-general по дате отправления: