Search Postgresql Archives

Re: Efficient sorting the results of a join, without denormalization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Sat, May 30, 2015, at 11:33 PM, David G. Johnston wrote:
> This is one problem with using made up surrogate keys...
> 
> The PK of A is a component of both the PK of B and the PK of C but you throw that information away by using serial fields for PKs instead.  You should have unique indexes on B and C that incorporate the ID from A

That is quite a strange schema, though isn't it? If you imagine it as
emails:

C = Emails
B = Folder
A = User

Now you're suggesting that even though an email belongs to to a folder,
which belongs to a user ... each email should also contain contain a
reference to a user? I guess that's fine, but seems unideal from a
redundancy perspective

> 
> All that said you really should put indexes on the foreign keys...

Yeah, of course. I purposely left that out, as I was asking which
indexes would need to be created to support that query


Thanks for your help!


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux