Re: [SQL] Trimming the cost of ORDER BY in a simple query

2005-05-03 Thread Ragnar Hafstaư
On Mon, 2005-05-02 at 21:35 -0700, [EMAIL PROTECTED] wrote: > Query (shows the last 7 dates): > > => SELECT DISTINCT date_part('year', uu.add_date), date_part('month', > uu.add_date), date_part('day', uu.add_date) FROM user_url uu WHERE > uu.user_id=1 ORDER BY date_part('year', uu.add_da

Re: [SQL] Trimming the cost of ORDER BY in a simple query

2005-05-03 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Ragnar Hafstaư <[EMAIL PROTECTED]> writes: > 20 ms does not sound like a big problem. > if 20 ms is really too much for you, and add_date IS a timestamp, > you might think about adding a date column , maintained > by triggers of by your application, and add an inde

Re: [SQL] Record Log Trigger

2005-05-03 Thread lucas
Well... Right, I will use to_timestamp() function instead of now() function. But, what is the performance for those Triggers??? Considering that all tables will have this Trigger and will check for each update or insert. Thanks Quoting CHRIS HOOVER <[EMAIL PROTECTED]>: One change you might want to

Re: [SQL] Function or Field?

2005-05-03 Thread lucas
Do I have to create another table to put this data??? But, Isn't it redundancy? :-/ The question is: For example: I have a "clients" table and I have a "taxes" table that is a chield of client. Is more efficient put fields into client table that contains: -) the count for paid taxes -) the c

Re: [SQL] Function or Field?

2005-05-03 Thread Tambet Matiisen
> > Hi. > What is the better way to store the last record for a translation??? > I.E: > The data for the last product vendding. > What is better: > a) Create a field in "product" table and create a Trigger > (before insert or update into vendding table) to alter this field. > b) Create a vie

Re: [SQL] Function or Field?

2005-05-03 Thread Frank Bax
At 07:58 AM 5/3/05, [EMAIL PROTECTED] wrote: Do I have to create another table to put this data??? But, Isn't it redundancy? :-/ The question is: For example: I have a "clients" table and I have a "taxes" table that is a chield of client. Is more efficient put fields into client table that conta