From: | Yessica Brinkmann <yessica(dot)brinkmann(at)gmail(dot)com> |
---|---|
To: | Joe Conway <mail(at)joeconway(dot)com> |
Cc: | Jony Cohen <jony(dot)cohenjo(at)gmail(dot)com>, laurenz(dot)albe(at)cybertec(dot)at, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: I think that my data is saved correctly, but when printing again, other data appears |
Date: | 2019-11-25 21:38:37 |
Message-ID: | CABrYqSM8hWYsmA=a1OCiu4uu7HxOTbws42w_++Pvg=F1gWJyOQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Good afternoon,
Well, I spent some time without implementing my thesis for a topic of
mental fatigue, I had to go for a while.
A few days ago I came back and was trying to implement the context change.
But I really believe that, although I read the explanations and source
codes that you indicated, and others that I found, I didn't quite
understand what I should do.
Well, as I was told that I should save the CurrentMemoryContext before
starting the SPI,
Let's say it would be before doing SPI_connect (). Is this correct?
And then I must use MemoryContextStrdup. As you told me the
MemoryContextStrdup It is used to create a copy of a string in a specific
memory context.
Well, where in the source code should I use MemoryContextStrdup? After
doing the SPI_connect () or where? I would use it from MemoryContextStrdup
to copy the data variable as I understand it, But in what context would I
have to create the copy? In a new context or what would the theme be like?
Should I use AllocSetContextCreate to create the new context or what would
the theme be like?
And if I have to create the new context with AllocSetContextCreate, where
in the source code will I have to create it? After doing SPI_connect () or
where?
The truth is that I also read the source code of
https://github.com/cohenjo/pg_idx_advisor but I don't see that The
MemoryContextStrdup that they told me to use has been used there.
Sorry for the inconvenience and see the same thing again. But as I
indicated, I also read the explanations they told me to read (which were
explanations about the memory contexts in Postgresql mainly) but there were
no examples of source code.
And since there is nothing on the Internet of examples that will help me to
use, I am asking again.
And the truth is that I didn't find examples of this in the Postgres source
code, just definitions, That is the source code where MemoryContextStrdup
is defined.
It may be very easy for you and you will see it very clearly, but for me it
really is not, and there are no examples of use on the Internet.
I really searched a lot and found nothing.
I would greatly appreciate a help please.
Regards,
Yessica Brinkmann
El lun., 28 oct. 2019 a las 12:39, Yessica Brinkmann (<
yessica(dot)brinkmann(at)gmail(dot)com>) escribió:
> Thank you very much for the answer.
> Best regards,
> Yessica Brinkmann
>
> El lun., 28 oct. 2019 a las 8:03, Joe Conway (<mail(at)joeconway(dot)com>)
> escribió:
>
>> On 10/27/19 8:01 PM, Yessica Brinkmann wrote:
>> > Thank you so much for the answers.
>> > By telling me this: "MemoryContextStrdup enables you to create a copy of
>> > a string in an explicitly specified memory context." I better understood
>> > the function of MemoryContextStrdup.
>> > And thank you very much to Mr. Jony Cohen for giving me the reference of
>> > his work. I really was already researching about his work, and I
>> > included it in the state of the art of my thesis, but I didn't look at
>> > the source code.
>> > I will be looking at the source code for a help, and especially in this
>> > case to see for the moment, the maintenance of the context for its
>> > subsequent restoration.
>>
>> For better understanding of how Postgres manages memory, you might want
>> to also read this:
>>
>>
>> https://github.com/postgres/postgres/blob/master/src/backend/utils/mmgr/README
>>
>> and possibly browse through this:
>>
>>
>> https://github.com/postgres/postgres/blob/master/src/backend/utils/mmgr/mcxt.c
>>
>> HTH,
>>
>> Joe
>> --
>> Crunchy Data - http://crunchydata.com
>> PostgreSQL Support for Secure Enterprises
>> Consulting, Training, & Open Source Development
>>
>>
From | Date | Subject | |
---|---|---|---|
Next Message | Игорь Выскорко | 2019-11-26 02:19:39 | Weird seqscan node plan |
Previous Message | Pavel Suderevsky | 2019-11-25 20:26:05 | [11.6] WALs recovery ordering with Restore Command - timelines |