[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: Primary keys and composite unique keys(basic question)
From:       Michael Lewis <mlewis () entrata ! com>
Date:       2021-03-31 16:03:21
Message-ID: CAHOFxGr9yhQEN=Fw3A4aqTA+RsdhCVzxfeSCdVzJRq7xW2shuQ () mail ! gmail ! com
[Download RAW message or body]

Etiquette on these lists is to reply in line or below the relevant portion,
not top-post with full quoting like default gmail behavior.

On Wed, Mar 31, 2021 at 9:18 AM Mohan Radhakrishnan <
radhakrishnan.mohan@gmail.com> wrote:

> But we don't search using UUIDs always. Only when data from another
> distributed service
> is received we need them and in such cases we have to join using them.
>

I haven't used them so I don't recall exactly, but I believe there is a
type of UUID generation which has some leading correlation to time which
would help with reducing the random I/O issue that Tom Lane mentioned. A
quick search of the archive may lead you to that, or someone else may chime
in with the name I expect.


> But for local data we can identify another composite unique key. Does
> PostgreSql
> create a unique index for us ? What about a FK that references this
> composite
> unique key ? Does it create a FK index ?
>

It is up to you to create whichever fkeys and indexes you require.

[Attachment #3 (text/html)]

<div dir="ltr"><div dir="ltr">Etiquette on these lists is to reply in line or below \
the relevant  portion, not top-post with full quoting like default gmail \
behavior.</div><div dir="ltr"><br></div><div dir="ltr">On Wed, Mar 31, 2021 at 9:18 \
AM Mohan Radhakrishnan &lt;<a \
href="mailto:radhakrishnan.mohan@gmail.com">radhakrishnan.mohan@gmail.com</a>&gt; \
wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>But we don&#39;t search using \
UUIDs always. Only when data from another distributed service<br></div><div>is \
received we need them and in such cases we have to join using \
them.</div></div></blockquote><div><br></div><div>I haven&#39;t used them so I \
don&#39;t recall exactly, but I believe there is a type of UUID generation which has \
some leading correlation to time which would help with reducing the random I/O issue \
that Tom Lane mentioned. A quick search of the archive may lead you to that, or \
someone else may chime in with the name I expect.</div><div>  </div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>But for local data we can \
identify another composite unique key. Does PostgreSql<br></div><div>create a unique \
index for us ? What about a FK that references this composite</div><div>unique key ? \
Does it create a FK index ?</div></div></blockquote><div><br></div><div>It is up to \
you to create whichever fkeys and indexes you require.</div><div></div></div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic