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
fieldsfor 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!