Skip to main content
Solved

PostGIS vaccum and analyze.

  • September 11, 2021
  • 9 replies
  • 255 views

itay
Supporter
Forum|alt.badge.img+17
  • Supporter

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

itay wrote:

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.

View original
Did this help you find an answer to your question?

9 replies

sigtill
Supporter
Forum|alt.badge.img+24
  • 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+17
  • Author
  • Supporter
  • September 12, 2021
sigtill wrote:

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+12
itay wrote:

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+17
  • Author
  • Supporter
  • September 15, 2021
itay wrote:

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+12
itay wrote:

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+17
  • Author
  • Supporter
  • September 17, 2021
itay wrote:

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+12
  • Safer
  • Best Answer
  • September 17, 2021
itay wrote:

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+17
  • Author
  • Supporter
  • September 20, 2021
itay wrote:

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+12
  • Contributor
  • July 15, 2024

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

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings