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

Поиск
Список
Период
Сортировка
От Glen M. Witherington
Тема Re: Efficient sorting the results of a join, without denormalization
Дата
Msg-id 1433047405.880573.282526153.009601AE@webmail.messagingengine.com
обсуждение исходный текст
Ответ на Re: Efficient sorting the results of a join, without denormalization  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Efficient sorting the results of a join, without denormalization
Список pgsql-general


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!


В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Efficient sorting the results of a join, without denormalization
Следующее
От: Rishi Gokhale
Дата:
Сообщение: date type changing to timestamp without time zone in postgres 9.4