From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Timasmith <timasmith(at)hotmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Can I getting a unique ID from a select |
Date: | 2007-03-07 03:48:26 |
Message-ID: | 20070307034826.GA20089@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Mar 05, 2007 at 17:07:25 -0800,
Timasmith <timasmith(at)hotmail(dot)com> wrote:
> >
> > > > > create view myview as
> > > > > select rownum, t1.field, t2.field
> > > > > from tableOne t1, tableTwo t2
> > > > > where t1.key = t2.fkey
>
> Multiple rows with the same key renders Hibernate useless as it caches
> the 'row object' and then returns the first row every time for that
> object.
>
> I think the sequence will work though, in reflection I guess it would
> as fast as pulling another field, and with the numbers would be a very
> long time before getting duplicates - even if you had thousands of
> users, returning 100s of rows every few minutes (I think...).
Based on the naming (t1.key vs t2.fkey) it looks like you may have a one
to many relationship. If so, can't you just bring in the primary key from
t2, as under the above assumption there will be only one matching row
from t1?
From | Date | Subject | |
---|---|---|---|
Next Message | Reuven M. Lerner | 2007-03-07 06:12:20 | Re: Database slowness -- my design, hardware, or both? |
Previous Message | Chris | 2007-03-07 01:15:58 | Re: Importing *huge* mysql database into pgsql |