Skip to main content
13-Aquamarine
Oct 15, 2024 2:20 PM UTC
Solved

How purge old data in data base or how count the number of tuples inside the data base

How do I purge data in the PostGreSQL database using retention, how do I calculate the number of tuples in the PostgreSQL database. In Thingworx version 8.5, the OA_OpertorAdviso-extension existed, which provided the PurgeOldProperties service and the GetVSTuples() service. Does something similar exist in Thingworx Version 9.6? Where can I find it?

BR

Dimitri

wcuiAnswer
16-Pearl
Oct 22, 2024 3:07 AM UTC

I am afraid no such extension(not retention) exist for ThingWorx 9.x.

Please refer to PostgreSQL guide and find the corresponding SQL statements.

You can run those statements from ThingWorx by using a Database thing.

For example, below SQL returns dead and live tuples for each database table.

    select n_live_tup, n_dead_tup, relname from pg_stat_all_tables order by relname

 

For how to use a Database thing inThingWorx, please refer to below article.

https://www.ptc.com/en/support/article/CS318728

 

3 replies

wcui16-PearlAnswer
16-Pearl
Oct 22, 2024 3:07 AM UTC

I am afraid no such extension(not retention) exist for ThingWorx 9.x.

Please refer to PostgreSQL guide and find the corresponding SQL statements.

You can run those statements from ThingWorx by using a Database thing.

For example, below SQL returns dead and live tuples for each database table.

    select n_live_tup, n_dead_tup, relname from pg_stat_all_tables order by relname

 

For how to use a Database thing inThingWorx, please refer to below article.

https://www.ptc.com/en/support/article/CS318728

 

Translate
14-Alexandrite
Oct 29, 2024 10:04 AM UTC

To implement retention, you might implement a database Thing, which might take a date or relative time like days or month, and removes data from DB older then that.

Translate
16-Pearl
Nov 19, 2024 1:18 AM UTC

Hi @dbologna ,

It appears that a response to this post answers your question.  For the benefit of other Community Members who may have the same question, it would be great if you could designate the proper one as the Accepted Solution.

In the event that this response did not answer your question, please post your current status so that we can continue to support.

Thanks for using the PTC Community!

Regards,

wcui

Translate