Where to run queries?
Asked by Vasudeva Gupta:

I want to get last modified dates for all pages . The link below talks about Analytics, Data Center and Server; whereas how to go to the server and where exactly to run the queries? Help me to navigate to the place where I can run the query.

<https://confluence.atlassian.com/doc/finding-unused-spaces-or-pages-107184852.html>


Answers:
author: Fabrice Huart - NSI
body: This article can also help , seems to be the same kind of request <https://community.atlassian.com/t5/Confluence-discussions/How-do-I-view-published-last-modified-date-for-all-pages-in-a/td-p/1937997>


author: Aron Gombas _Midori_
body: If you can't get access to the database to run those queries, you could just use the Page Status Browser provided by the [Better Content Archiving](https://marketplace.atlassian.com/apps/123/better-content-archiving-for-confluence?hosting=server&tab=overview) app.

It allows working a tree control that shows the last update date:

![page-status-browser (1).png](https://community.atlassian.com/t5/image/serverpage/image-id/252908iE8B25FE19E226F67/image-size/large?v=v2&px=999 "page-status-browser (1).png")

(Discl. it is a paid and supported app developed by our team.)


author: Radek Dost?l
body: It states
> If you have Confluence Server, you'll need to query **the database directly** to find out this information.

It's SQL language which you'd run in a database client, which is dependent on which database type your Confluence is connected to. Most commonly this would be PostgreSQL (but you might just as well be running a different database):

<https://www.postgresql.org/docs/current/app-psql.html>

But you could just as well be running on plenty other db types such as MySQL which uses a different client, etc.

However, you would of course need to also know where the database is running, the database name to connect to, credentials to use, and most importantly, running SQL directly can have devastating effect if you do not know what you're doing. I would suggest you talk to your sysadmin(s) who set up Confluence as they should be familiar with how to connect to the db and how to run queries in it.

That said, this is only specific to **Server** edition of Confluence, if you are in fact running **Data Center** (which you should imo because Server is nearing end of life), then you can use the "Insights" which is baked into data center, without having to run SQL - <https://confluence.atlassian.com/doc/analytics-1044780333.html>

You can see more info about the database in "System info" page in Confluence (to determine the type for example), and the db settings are in \<confluence_home\>/confluence.cfg.xml file such as the address, name, and most importantly the credentials Confluence uses to talk with the db.


author: Fabrice Huart - NSI
body: Hi [@Vasudeva Gupta](/t5/user/viewprofilepage/user-id/5200332) ,

The queries must be run directly in your database associated to Confluence ( for Server and Datacenter versions of the product)

depending on the kind of database, you can use different tools to access it. For example , you can use tools like Pg Admin to access PostgreSQL

Or you can ask your database administrators to run the queries.

For Cloud you must go through Confluence Cloud Rest API, but not sure if this information is available.

Hope this helps,

Fabrice