[Bucardo-general] Design of new txntime field

Ioana Danes ioanadanes at gmail.com
Fri Nov 6 15:09:15 UTC 2015


On Fri, Nov 6, 2015 at 9:35 AM, Jon Jensen <jon at endpoint.com> wrote:

> On Fri, 6 Nov 2015, Greg wrote:
>
> greg=# select to_char(current_timestamp,'YYYY-MM-dd.HH24:MI:US ') ||
>> pg_backend_pid();
>>            ?column?
>> -------------------------------
>>  2015-11-06.08:35:460738 10638
>>
>
> That's missing seconds, though, which are pretty important. :) I think
> you'd want:
>
> select to_char(current_timestamp,'YYYY-MM-dd HH24:MI:SS.US ') ...
>
> Ioana wrote:
>
> In our database, we have 2 big tables and one of them that has about 300
>> million records has an index on a text field that has 16-20 characters.
>> When I have to restore a backup of the database that index takes 10 times
>> longer than any other index. I know the delta and track table won't get
>> that big so it might not be a problem for this app. How about using 2
>> fields in the primary key. One the current txntime field and one a serial
>> id field.
>>
>
> I'm guessing that the varchar version would take way more disk space, and
> the index would be way bigger and slower.
>
> So I too wonder whether a composite 2-field primary key would be better.
>
> For the sake of completeness do we need to discuss the likelihood of
> getting the same PID at the same microsecond from two different machines? :)
>
> Why even bother to use a PID when the postgres sequence does the job so
well?

> Jon
>
>
> --
> Jon Jensen
> End Point Corporation
> https://www.endpoint.com/
>

Ioana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20151106/4ffb804a/attachment-0001.html>


More information about the Bucardo-general mailing list