# Discourse Data Explorer

**URL:** https://meta.discourse.org/t/discourse-data-explorer/32566
**Category:** Plugin
**Tags:** official, data-explorer, included-in-core
**Created:** [August 26, 2015, 11:46pm UTC](https://meta.discourse.org/t/discourse-data-explorer/32566 "2015-08-26T23:46:06Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [August 26, 2015, 11:46pm UTC](https://meta.discourse.org/t/discourse-data-explorer/32566/1 "2015-08-26T23:46:06Z")

</div>

| | | |
| --- | --- | --- |
| :discourse2: | **Summary** | **Discourse** [Data Explorer](https://meta.discourse.org/t/32566?silent=true) allows you to make SQL queries against your live database, allowing for up-to-the-minute stats reporting. |
| 📖 | **Install Guide** | **This plugin is bundled with Discourse core**. There is no need to install the plugin separately. |

> [@](#):
>
> :discourse2: As this is an #official plugin maintained by the Discourse team, #Support, #Contribute > Bug, #Contribute > UX, and #Contribute > Feature requests can be made in the respective categories here on Meta, and tagged with the appropriate plugin tag. Click on a link below to get one started. 👍
> 
> [❓ **Support**](https://meta.discourse.org/new-topic?category_id=6&body=%3E%20Before%20asking,%20did%20you%20search%20first%3F%20Press%20%F0%9F%94%8D%20at%20the%20upper%20right%20to%20search.&tags=data-explorer "Ask for support on configuring and using Discourse Data Explorer") [🐛 **Bug**](https://meta.discourse.org/new-topic?category_id=1&tags=data-explorer "A bug report means something is broken, preventing normal/typical use of the plugin") [👀 **UX**](https://meta.discourse.org/new-topic?category_id=9&tags=data-explorer "Discussion about the user interface of Discourse Data Explorer, and how features are presented (including language and UI elements)") [💡 **Feature**](https://meta.discourse.org/new-topic?category_id=2&tags=data-explorer "Discussion about how existing Discourse Data Explorer features can be improved or enhanced, and how proposed new features could work")

> ℹ If you’re looking for examples or support for any custom queries, you can find lots of topics in our #data-reporting category under the #sql-query tag. If there’s not one to suit your particular needs, please feel free to create a new topic to ask the community for some help. [📝 **Query Help**](https://meta.discourse.org/new-topic?category_id=148&tags=sql-query "Create a new topic to ask for help or share your top examples")

> :discourse2: Hosted by us? This plugin is available on our Business and Enterprise plans. [Data Explorer | Discourse - Civilized Discussion](https://www.discourse.org/plugins/data-explorer.html)

After installing the plugin, head to `/admin/plugins` .

![de1](https://global.discourse-cdn.com/meta/optimized/3X/c/d/cdf0a47c79669d0b9f5348e43d5d3d67ab6fd5e2_2_690x40.png)

Click on the “Settings” button, and turn on `data explorer enabled`, then return and reload the page.  
There should now be a tab in the stacked nav called “ [Data Explorer](https://meta.discourse.org/t/32566?silent=true) ”. Select it or head to `/admin/plugins/discourse-data-explorer` , then use the + , Import or Run buttons to get started.

### Default queries

On a fresh install, the [data explorer](https://meta.discourse.org/t/32566?silent=true) now ships with several queries that can help you draw insights from your forum’s activity. Open any query and click Run to try it out.

> **Here's what the stock queries look like.**
>
> _Note:_ Default queries are picked up from this file: [discourse-data-explorer/lib/discourse\_data\_explorer/queries.rb at main · discourse/discourse-data-explorer · GitHub](https://github.com/discourse/discourse-data-explorer/blob/main/lib/discourse_data_explorer/queries.rb)
> 
> ![de3](https://global.discourse-cdn.com/meta/original/3X/7/b/7beaafdbd3305fa6cf2d2875847af3c53ce30d71.png)
> 
> If you have an awesome query that you want everyone to have, make a PR just [like this one.](https://github.com/discourse/discourse-data-explorer/commit/931bbb67a07a57965c3da8ca471ee2283eeb1f27)

Default queries cannot be edited, feel free to copy the sql and paste it into a new query if you’d like to modify them.

### Writing queries

When you click any of the Edit buttons on a query view, or start a new Explorer Query, you are presented with a screen like the one below:

 ![](https://global.discourse-cdn.com/meta/original/3X/7/a/7a1873ed97eaccfa215a8669c4e5e95202fa684e.png)

The top two boxes are the name and description of the query. The name is what you’re selecting in the dropdown box, and the description should be used for things like explaining what to put in the query parameters or to describe what data is being queried.

The left pane is where you write the SQL query. Minor syntax highlighting and checking is provided.

> [@](#):
>
> ⚠ The schema explorer is on the right side of the writing pane. Note the red column names with a warning symbol, such as `email`, `password_hash`, `salt` - these are _“Sensitive”_ columns. Try to avoid querying them if possible, reconsider querying them if you are in a public location, and definitely do not post screenshots of queries checking those columns without thinking about what you’re doing first.

### Automatically running queries

While you can always run a query by clicking the Run button, you can save time when loading a query by adding the `run` parameter to the URL.

For example: `/admin/plugins/discourse-data-explorer/queries/123?run`

When this parameter is added to the URL, the query will run as soon as you load the page, so you don’t need to click the Run button to see the results. This is especially helpful for queries you run frequently, allowing you to bookmark them or add them to your sidebar with the `run` parameter included for a one-click report.

### Importing queries

For an example, let’s import one that I wrote. Download this file, then open the import dialog and select the file to be uploaded or paste the query in the text box. Click Import to save it and then click Run to see the results.

[most-common-likers.dcquery (1).json](https://global.discourse-cdn.com/meta/original/3X/f/b/fb837a5551217ea43ca1a732681f641bf952856c.json) (442 Bytes)

 ![de2](https://global.discourse-cdn.com/meta/original/3X/8/5/85f1edfb3a1c614a0974fc9cf1d40b8482187116.png)

 ![de4](https://global.discourse-cdn.com/meta/original/3X/f/d/fd95fecd82468ddbcd90570f5404ed0d8a174c73.png)

Looks like all of the Discourse developers like each other quite a bit ❤

### Searching for queries

If you’ve accumulated too many awesome queries, no problem! The search bar can help you filter through titles and descriptions.

 ![de5](https://global.discourse-cdn.com/meta/original/3X/5/9/592c9997cfe61675589ee044126c57adfa18570a.png)

### Allow non-staff groups to run queries

You can add specific groups (including moderators) to a query to grant them access to it:

 ![image](https://global.discourse-cdn.com/meta/original/3X/9/9/99e25b75d0eb607264535469b2d653ab6e3ba315.png)

After saving, you can find it from the Groups page for that particular group on the **Reports** tab:

 ![image](https://global.discourse-cdn.com/meta/original/3X/2/0/20f0212e011ee5ff7b8e5dacaffd284a61c7651d.png)

Click any query to open it and then the Run button to see the results. You can also bookmark group reports by clicking the Bookmark button.

 ![image](https://global.discourse-cdn.com/meta/original/4X/6/0/0/6006cae70602a7fc90c753fcbce13bd7910e74a5.png)

### Sharing queries with predefined parameters

If you have included user-defined parameters in your query, you can share a link to the query and include the parameters in the URL so they will be pre-filled when the page loads.

You must include parameters in the URL in this format `params={"parameter_name":"value"}`. Separate multiple parameters with commas. For example:

```plaintext
discourse.example.com/g/my-group/reports/6?params={"param1":"value1","param2":"value2"}

```

Couple with the `run` parameter [mentioned above](https://meta.discourse.org/t/discourse-data-explorer/32566#p-138280-automatically-running-queries-3), you can share a report with predefined parameters that runs automatically when loaded.

### Result limits and exporting queries

With large queries, you may notice that there is a limit on the number of rows that the [Data Explorer](https://meta.discourse.org/t/32566) will display. By default, the limit is set to 1000 rows. This is to prevent excessively large queries from slowing down or disrupting the performance of your Discourse instance.

If you want to bypass this limit, you have a few of options:

1. **Pagination** : You can paginate your results. Instead of trying to return all results at once, you can write your query to return a specific range of results. You can then adjust this range to view different sections of your data. This won’t increase the limit, but it will allow you to view all your data in sections.
2. **Increase the limit** : If you have access to the Discourse server and are comfortable making changes to Discourse settings, you can increase the limit. However, this should be done with caution. Increasing the limit can put a lot of load on your server if you’re not careful, especially if multiple users are running large queries at the same time.
3. **Download the Results** : You also have the option to download the query results instead of viewing them directly in Discourse by clicking either the `JSON` or `CSV` button after running the query. Data downloaded from a query in JSON or CSV format will have a much higher results limit of 10,000 rows. For programmatic purposes, you want want to opt for the Json format, or if you’d like to work on the data in a spreadsheet application, the CSV format might be more convenient.

 ![image](https://global.discourse-cdn.com/meta/original/4X/e/e/a/eead52ce3424871230e30d8a7b9c446f36310611.png)

It’s generally a good idea to try and write more efficient queries, or to filter your data so that you’re only retrieving what you need, rather than trying to bypass the limit.

You can also export the SQL query itself in `.JSON` format by clicking the Export button. Queries that are exported using this method can then be imported into other Discourse sites, or used with third party applications.

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/6/2/d62cdcfda27c1a895c96884c2b684560f60d128b.png)

### Query plan

The “Include query plan” checkbox can be used for better understanding and optimizing your SQL queries.

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/6/5/5659f371a690bfbc486ee37bc417b18a4e2d3c47.png)

When you check this box and run a query, Discourse will display the sequence of operations used to access data in the Discourse database. This can include operations like scans, joins, sorts, and other database actions. By examining the query plan, you can see exactly how the database is executing your query.

### The [Data Explorer](https://meta.discourse.org/t/32566?silent=true) tutorial series

We also have a dedicated #sql-tutorial series about the [Data Explorer](https://meta.discourse.org/t/32566)! If you’re interested in learning more about writing SQL queries in Discourse, we highly recommend reading through the topics in this series:

- [Data Explorer Tutorial - Part 1 - Writing Your First Query](https://meta.discourse.org/t/data-explorer-tutorial-part-1-writing-your-first-query/277925)
- [Data Explorer Tutorial - Part 2 - Discourse SQL Basics](https://meta.discourse.org/t/data-explorer-tutorial-part-2-discourse-sql-basics/277927)
- [Utilizing Parameters in Data Explorer Queries](https://meta.discourse.org/t/utilizing-parameters-in-data-explorer-queries/277934)
- [Formatting Data Explorer Table Results](https://meta.discourse.org/t/formatting-data-explorer-table-results/277939)

> Last edited by @MarkDoerr 2026-02-25T00:39:12Z
> 
> Last checked by @hugh 2025-09-03T00:45:21Z
> 
> > **Check document**
> >
> > Perform check on document:

---

_[View the full topic](https://meta.discourse.org/t/discourse-data-explorer/32566)._
