How to View Full text of Top query in AWS RDS Postgres - performace insights - postgresql

I'm using the Postgres database from AWS RDS. I want to see the full text of Top query in AWS RDS performance insights.
Link: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.UsingDashboard.html#USER_PerfInsights.UsingDashboard.SQLTextLimit
As per the documentation, I've updated the track_activity_query_size to the max: 102400, have also tried rebooting the Postgres DB instance, still, it shows the same truncated <= 500 chars.
PS: my Postgres DB instance version is 12.5
Can someone help?

You can enable the PostgresSQL logs and search the half length queries in the latest logs wherein you will get the full length queries of the same.
Go to the "Logs & events" tab in the respective database from RDS console and download the log. Then search using some file editor to get the full length queries.

Related

Unable to get the list of queries in azure postgresql?

Pg_stats_actvity is used in pgadmin 4 but it give only current queries.
And also checked on azure portal for logs in server logs there can't see the logs for queries.
If anyone know help on this it is azure postgresql server.
Need Queries for one perticular database.
I tried below query in pgadmin 4
Select * from pg_stats_activity
It is azure postgresql single server i checked logs and diagnostics.
Also tried explain analyse.
Help me to get list of queries in postgresql database for perticular time interval
You have several options in Postgres to capture queries.
You've already found that pg_stats_activity shows active, running queries.
The pg_stat_statements extension will show aggregated information for query fingerprints.
The log_statement configuration will log queries that were sent to the database into your postgres.log. Use the log_line_prefix configuration to capture more details into the logs.
The pgaudit extension will capture queries that were executed on the database, with nicely formatted output for easy parsing or to send to log aggregation tools.
Here's an Azure doc that describes how to set these in the UI and how to view the resulting logs: https://learn.microsoft.com/en-us/azure/postgresql/single-server/concepts-server-logs.
In your case, setting log_statement to 'all' should be a good start.

AWS RDS PostgreSQL - Indexes being dropped automatically shortly after creation

I'm creating indexes via pgAdmin for my PostgreSQL database hosted via AWS RDS with the following command:
CREATE INDEX team_idx_teamid ON team ("teamId");
Which returns the response:
Query returned successfully in 1 secs 575 msec.
And it is displayed in pgAdmin UI:
After a few minutes it disappears. Looking at the event logs in AWS I see the following message:
2021-06-21 11:21:58 UTC:13.58.56.170(51704):[16657]:STATEMENT: DROP INDEX "team_idx_teamid"
I can't find anything related to why indexes are being dropped or cleaned up in my google searches. Anyone got any ideas of what is going on?
Many thanks

Monitor postgres 9 queries

There is a postgres 9 with database AAA that is used by my application. I use pgadmin 4 to manage it manually.
I would like to check what queries are executed by this application on database AAA in real time.
I did a research about monitoring options in pgadmin in vain.
Is is possible to do that by using just pgadmin4? Or is it necessary to use another tool (if yes - what is he name of this tool)?
When I point pgAdmin4 at a 9.6 server, I see a dashboard by default which shows every session (done by querying pg_stat_activity). You can then drill down in a session to see the query. If a query last for less time than the monitoring interval, then you might not see it if the sample is taken at the wrong time.
If that isn't acceptable, then you should probably use a logging solution (like log_statemnt='all') or maybe the pg_stat_statements extension, rather than sample-based monitoring. pg_stat_statements doesn't integrate with the dashboard in pgAdmin4, but you can select from the view from an SQL window just like you can run any other SQL. I don't believe pgAdmin4 offers a built-in way to monitor the database server's log files, the way pgAdmin3 did.

Connecting to Amazon Redshift in Azure Data Studio via the Postgresql Connector

I've recently joined a company with a mixed set of databases that include a Redshift cluster and some SQL databases. I'd like to use a single IDE to access both for analytical reporting, so I don't have to switch between tools. I'm currently using workbench, which works, but it's not clicking with me.
I do like Azure Data Studio, but it's SQL Server and Postgres only. Given the similarities between Redshift and Postgres, I thought I'd see if I could connect using the Postgres driver.
I've installed the Postgres extension and can "connect" to the database. However when I try to explore the database using the tree view, I get the error message 'Cannot Expand Node'. When I run a simple query that works in workbench, e.g.
Select * from [server].[database].[table]
I get the following Error message:
Started executing query at Line 1
cursors can only be used within the transaction that created them.
Total execution time: 00:00:00.019
I know I'm trying to do something that shouldn't be done. And if I can't, I can't. But has anyone here managed to get a redshift connection going in Azure Data Studio?
FWIW, I've come across a GitHub Repository that may be a Redshift driver for data studio - but this looks like a clone of the Postgres driver, with no activity since march (not even renaming the 'Postgres' titles to Redshift)... and therefore I'm dubious.

how to connect redshift cluster using tableau 8.0 desktop

I have downloaded Tabeleau 8.0.1 desktop version. I am able to connect my local postgres database through tableau.
But when I try to connect to the redshift cluster, I am getting an error - invlaid userid /password. I already have passed userid and password correctly. FYI, I am able to connect redshift through sqlworkbench/j, command line prompt (psql) & pgadmin III. And I already have downlaoded the redshift driver as per http://www.tableausoftware.com/support/drivers.
However I am not able to connect redshift cluster through tableau.
Amazon Redshift has a direct connect with Tableau. When you start Tableau, please use the Connect to Data option and then choose Amazon Redshift on the left. You'll see the following log-in screen. You shouldn't need to worry about drivers. Also, the Tableau trial version is the full version, so there is no limiting of features.
You can read more here, and watch a video. Also technical details are here. You may want to try version 8.1, which is the most recent version (also has 64 bit)