Re: table alias on update, another update question

From: nolan(at)celery(dot)tssi(dot)com
To: bruno(at)wolff(dot)to (Bruno Wolff III)
Cc: pgsql-general(at)postgresql(dot)org (Postgres general mailing list)
Subject: Re: table alias on update, another update question
Date: 2003-06-24 16:33:30
Message-ID: 20030624163330.6557.qmail@celery.tssi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I think something like the following is best. I rewrote the max and min
> functions in a way that will work well if there is a combined index on
> t2_key and t2_col1 as well as t2_key and t2_col2. Another approach would
> be to join to a group by select from table2. There may be some circumstances
> where that gives you better performance, but I can't think of a particular
> circumstance where that is likely offhand.

I hadn't thought of using LIMIT in that context, a nice trick to remember!

That worked fairly well even with an index just on the keys. It took
about the same time as just loading the data from the first record in
each key group.
--
Mike Nolan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2003-06-24 16:38:51 Re: Selecting dupes from table
Previous Message Richard Huxton 2003-06-24 16:24:16 Re: Dump/Restore and sequence permissions