Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identifying SQL statements #86

Open
drnextgis opened this issue Feb 9, 2024 · 0 comments
Open

Identifying SQL statements #86

drnextgis opened this issue Feb 9, 2024 · 0 comments

Comments

@drnextgis
Copy link
Contributor

drnextgis commented Feb 9, 2024

I'm struggling to identify the SQL queries produced by stac-fastapi-pgstac. From what I've gathered, asyncpg utilizes prepared statements. This explains why, when I inspect the pg_stat_activity table, the entries appear in a format like this:

postgis=> SELECT datname, pid, state, query, age(clock_timestamp(), query_start) AS age 
FROM pg_stat_activity
WHERE state <> 'idle' 
    AND query NOT LIKE '% FROM pg_stat_activity %' 
ORDER BY age;
 datname |  pid  | state  |                           query                            |       age       
---------+-------+--------+------------------------------------------------------------+-----------------
 postgis | 28867 | active |                                                           +| 00:00:00.09398
         |       |        |                     SELECT * FROM search($1::text::jsonb);+| 
         |       |        |                                                            | 
 postgis | 18963 | active |                                                           +| 00:00:00.126161
         |       |        |                     SELECT * FROM search($1::text::jsonb);+| 
         |       |        |                                                            | 
(2 rows)

How can I see the actual SQL statements? Does it make sense to add logging.debug here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant