Re: Help with rewriting query

From: Tobias Brox <tobias(at)nordicbet(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: junaili(at)gmail(dot)com, pgsql-performance(at)postgresql(dot)org
Subject: Re: Help with rewriting query
Date: 2005-06-11 09:59:09
Message-ID: 20050611095909.GR8451@tobias.nordicbet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

[Kevin Grittner - Fri at 02:49:57PM -0500]
> If you add a column to the person table for "last_food_id" and triggers
> to maintain it when the food table is modified, voila! You have a
> simple and fast way to get the results you want.

Reminds me about the way the precursor software of our product was made,
whenever it was needed to check the balance of a customer, it was needed to
scan the whole transaction table and sum up all transactions. This
operation eventually took 3-4 seconds before we released the new software,
and the customers balance was supposed to show up at several web pages :-)

By now we have the updated balance both in the customer table and as
"post_balance" in the transaction table. Sometimes redundancy is good.
Much easier to solve inconsistency problems as well :-)

--
Tobias Brox, +47-91700050

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Cosimo Streppone 2005-06-11 11:05:55 Re: faster search
Previous Message Joshua D. Drake 2005-06-11 00:55:51 Re: faster search