Skip to main content
Solved

PostGIS vaccum and analyze.

  • September 11, 2021
  • 9 replies
  • 355 views

itay
Supporter
Forum|alt.badge.img+18

Hi there.

I was wondering which type of parameter is used when enableing vaccum analyze tabel in a Postgis writer feature type (https://www.postgresql.org/docs/current/sql-vacuum.html) . Is it a FULL vacuum? all I see in the logfile is: Vacuuming and analyzing table ....

Any tips on how to query that information from the database?

Thanks in advance.

 

Itay

 

Best answer by danminneyatsaf

Hi @Sigbjørn Herstad​ thanks for the tip, still seeing only VACUUM ANALYZE so I guess this is just plain vaccum.

@itay​ 

I was able to run the SQL in "SQL to Run Before Read" on the Reader. However I know you're trying to use this on the writer, so I'm not sure if this works for your scenario. Either way let me know if this helps at all. 😀

Postgresql-vacuum-freeze-example 

Additionally, I was curious which version of Postgresql you are running? This probably isn't causing the issue but is useful to know anyways.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

9 replies

sigtill
Supporter
Forum|alt.badge.img+25
  • Supporter
  • September 12, 2021

Can you see the SQL on the Postgresql side by examining running queries while running the workspace @itay​ 


itay
Supporter
Forum|alt.badge.img+18
  • Author
  • Supporter
  • September 12, 2021

Can you see the SQL on the Postgresql side by examining running queries while running the workspace @itay​ 

Hi @Sigbjørn Herstad​ thanks for the tip, still seeing only VACUUM ANALYZE so I guess this is just plain vaccum.


danminneyatsaf
Safer
Forum|alt.badge.img+13

Hi @Sigbjørn Herstad​ thanks for the tip, still seeing only VACUUM ANALYZE so I guess this is just plain vaccum.

Hi @itay​, I believe you are correct. The vacuum option in the PostGIS writer is a VACUUM ANALYZE.


itay
Supporter
Forum|alt.badge.img+18
  • Author
  • Supporter
  • September 15, 2021

Hi @Sigbjørn Herstad​ thanks for the tip, still seeing only VACUUM ANALYZE so I guess this is just plain vaccum.

Hi @danminneyatsaf​, Thanks for confirming this. I have been trying to use the vacuun freeze analyze option via an SQL statement but the database keep complaining that it cannot be carried out in a transaction.

 

So I tried using:

begin;

VACUUM FREEZE ANALYZE my_table;

end;

 

But still no joy and ideas on that?


danminneyatsaf
Safer
Forum|alt.badge.img+13

Hi @Sigbjørn Herstad​ thanks for the tip, still seeing only VACUUM ANALYZE so I guess this is just plain vaccum.

@itay​ I see some documentation mentioning that Postgresql 9.0+ should be formatted as: VACUUM(FREEZE) [tablename]. This may or may not help for your scenario but I just wanted to put that out there.

 

Additionally, are you able to share the message you are getting back from the database when trying to carry out the transaction?


itay
Supporter
Forum|alt.badge.img+18
  • Author
  • Supporter
  • September 17, 2021

Hi @Sigbjørn Herstad​ thanks for the tip, still seeing only VACUUM ANALYZE so I guess this is just plain vaccum.

Yes the message is: ERROR: VACUUM cannot run inside a transaction block

For the following SQL (with or without parenthesis) :

FME_SQL_DELIMITER ;

BEGIN;

VACUUM FREEZE ANALYZE srv_demo.ns_bijlagen;

COMMIT;

END;

 

If I run:

 

COMMIT;

VACUUM FREEZE ANALYZE srv_demo.ns_bijlagen;

 

via DBeaver it works just fine.

 

Trying it via de SQLExecutor results in the following error:

 

 

 


danminneyatsaf
Safer
Forum|alt.badge.img+13
  • Safer
  • Best Answer
  • September 17, 2021

Hi @Sigbjørn Herstad​ thanks for the tip, still seeing only VACUUM ANALYZE so I guess this is just plain vaccum.

@itay​ 

I was able to run the SQL in "SQL to Run Before Read" on the Reader. However I know you're trying to use this on the writer, so I'm not sure if this works for your scenario. Either way let me know if this helps at all. 😀

Postgresql-vacuum-freeze-example 

Additionally, I was curious which version of Postgresql you are running? This probably isn't causing the issue but is useful to know anyways.


itay
Supporter
Forum|alt.badge.img+18
  • Author
  • Supporter
  • September 20, 2021

Hi @Sigbjørn Herstad​ thanks for the tip, still seeing only VACUUM ANALYZE so I guess this is just plain vaccum.

Hi @danminneyatsaf​ ,

 

Thanks for the tip, I have added the SQL statement in the SQL to Run After Writing in the Feature Writers I am using. Not much sense doing it on a table without data in it :)

Problem solved👍


arthur_bazin
Contributor
Forum|alt.badge.img+18
  • Contributor
  • July 15, 2024

Just to let people know that I created an idée to avoid using a transaction block in the SQLExecutor :