Explorateur de données Discourse

:discourse2: Summary Discourse Data Explorer allows you to make SQL queries against your live database, allowing for up-to-the-minute stats reporting.
:open_book: Install Guide This plugin is bundled with Discourse core. There is no need to install the plugin separately.

:information_source: 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. :memo: Query Help

:discourse2: Hosted by us? This plugin is available on our Business and Enterprise plans. Data Explorer | Discourse - Civilized Discussion

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

de1

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 ”. 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 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

If you have an awesome query that you want everyone to have, make a PR just like this one.

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:

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.

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 (442 Bytes)

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

Searching for queries

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

Allow non-staff groups to run queries

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

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

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.

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:

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

Couple with the run parameter mentioned above, 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 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.

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.

Query plan

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

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 tutorial series

We also have a dedicated sql-tutorial series about the Data Explorer! If you’re interested in learning more about writing SQL queries in Discourse, we highly recommend reading through the topics in this series:

Last edited by @MarkDoerr 2026-02-25T00:39:12Z

Last checked by @hugh 2025-09-03T00:45:21Z

Check documentPerform check on document:
120 « J'aime »
Data Explorer Tutorial - Part 1 - Writing Your First Query
Daily graph of user time online
Data Explorer Tutorial - Part 2 - Discourse SQL Basics
Formatting Data Explorer Table Results
Visual forum statistics
Extracting email addresses for a group
Visual map of users
Can I see in the statistics which post received the most likes
Tags: how can admin see who is following what tags?
How do I download a record of top posts or most clicked links?
Retrieving user information via REST API
Can staff be able to see real author of anonymous posts
How to search/filter untagged topics
Exporting all Topic titles and IDs?
External Data Analysis
Redesign of use profile
How to look up a user based on a user_id?
Can I make a plug-ins to view a certain group of people?
Scan IP matched accounts
How to measure active users?
Legal Tools Plugin
Can I access my Discourse forum database?
Create report for amount of interactions per user
CSV of all editeds post by moderator
Discourse view file update does not reflect in browser
Where to find User ID information
[Paid] Data explorer queries for ticketing system use case
Transactional Email Service (Open Source)
Direct connect to the Discourse Database
See what categories new users (& other trust levels) post in most
How can I extract the adminstrative records for a EU GDPR request?
Counting and reporting post views for commercial forum users (so we can charge them per-view)
Top user list public
How do I audit votes for fraudulent behavior
How do I get a list of all users from the API?
Tracking referrals? Encouraging users to invite others?
Display Data Explorer query results in WordPress (with TwigAnything)
Database's Data Model?
Filter or create statistics
How do I add users to a group?
Discourse disk space limits per user?
Masonry Image Gallery
Estimated timeline on a project?
Report on User Fields?
Dashboard - Segment number of Posts and Topics by team
Badge image missing issue
Traditional multi level hierarchy vs flat discourse hierarchy
Is there a Trust Level Permissions Table?
Deleting posts by banned users with < 3 posts?
Calculating "Top" topics in Discourse
Is there a way to Search by Posts with No Staff replies on it
How to use SQL to query discourse database
Specify user by external id
How to check the uniqueness of users in "hot link" badge?
Active users per day
Questions about moving an existing forum to Discourse
Get a user object by username or id javascript
Best Practices on reply-by-email
Most liked reply
Likes on a post
Group forum members based on topics viewed?
The metrics on dashboard, do they include activities from administrators?
Can I access Discourse forum Database to use for PowerBI reporting?
Is there a log of user visits?
Find posts "solved" in specific month
Anonymous User Groups
Any way to NOT send emails when a topic category is changed?
View/read by user or of user's posts?
After server migration the images in posts aren't downloadable anymore
Bug with [code]anything[/code] on a single line by itself
Logo is not appearing showing broken after upload
Configuring how users can create and send invites for others to join your community
Users reporting lots of 502 errors when attempting to post due to "max consecutive replies" check
Wildcard search
What would you like to see on your Discourse 2.0 Admin Dashboard?
TeamSpeak Usergroups Sync
Use tags to duplicate images?
Database Access required for our forum
Updated discourse and now site fails to display
Automatic badge expiration
Looking to switch from Vanilla, and have a few questions
Comment on a question instead of answering it
How to create custom reports
Deleted username but can not use that username in other user
Category Remains Muted after Category is available to Everyone
Can staff see who voters in anonymous polls?
Speak to a Discourse Data Analytic representative
How do I pull a report for a single community member?
Report Links to New Topics by Date?
Excluding Suspended, Silenced and Suspect Users When Exporting
Theme-Component v Plugin: What's the difference
Export topics to Excel
Is there a document introducing the database schema design?
Overview which trust level has which possibilities
Why are some users greyed out?
How to get reports for just a specific category?
How to get posts viewed by a user via APIs?
Reports for group message statistics
TimeStamp of Tag
How we put people in a category?
Is it possible to see the dates of all scheduled topics?
Topic Count Per User for Custom Date?
Searching for unassigned topics
Reports by Discourse
How to see all invites and invite tree?
How can I get the list of Discourse Topic IDs dynamically
How to edit sign up form?
Filter posts with images (gallery view)
Tracking unique contributors
New users who visited this month?
Making report on group membership?
Where to find post contents in the database
Searching All Messages as an Administrator
Are Staff and All Groups Included in Dashboard Reporting?
Deleted user with rails console u.delete -> email still "taken"
First Name, Last Name
User posts export as csv or text
User Messages Inbox Error 500
Description of fields returned by Discourse API
Failed to bootstrap due to out of memory killer
Inviting Feedback for Discourse Wiki ("Morphpedia")
What will happen to my forum if discourse suddenly stopped?
Why aren't warnings easily accessible like suspensions are?
Create a Data Explorer query using the API
Automate the syncing of Discourse queries to Google Sheets
Organization of community Data Explorer queries
Get total list of topics and their view counts from Discourse API
Working around the 10,000 result limit of data explorer?
Selecting the Quarter results in custom way
Create a Report on Profile data
Who marked Solution for Topic
Can you view a 'revised' post after it has been revised
More data from Admin reports
Regarding possibility to use Discourse as an alternative to JIRA or Zendesk
Retrieve latest posts by ID
More granular Discourse metrics?
Dump all conversations in a file and structured data
Login type report / list?
Special role to access dashboard
Best API for All First Posts in a Category
Data Explorer: Posts by Category (Including Subcategories)
Can the period stats use custom time frames to not be limited to only the most recent period?
Tracking who accepted which invite link
Advanced Search: Find posts having staff color
2021: The Year in Review
Filter topics not answered by Staff
Can I download a user database and sort by time viewed?
Category API request downloads all topics
User Data By Date Rage
Browse the Postgres database
How do I extract raw data from my discourse community site?
Some issues with searching (sorting, searching deleted posts and such)
How to Delete Uploaded Files?
How to show badges in the message list?
How to show badges in the message list?
How to find pageview data for a specific topic?
Badges for X Number of Solutions Created?
Permanent deletion bug
Adding SSO after many users already signed up -- how to migrate them?
How could I get voters from a poll?
Notifications from muted categories when mailing list mode is enabled
API: how to get joined at date in user summary
Edit a user preference for everyone or a subset of users
Create a Network chart of your forum - data visualization
Discourse Narrative Bot Data Explorer Queries :robot:
How do I get a report of total topics by subcategory for all subcategories please?
Plugin causing errors during rebuild
User field searching / reporting
Admin dashboard report reference guide
Comment, Question, & Discussion Level Agreement Voting - is there an extension?
How to find deleted posts
SQL query for last created users of the past 30 days
How can I see Survey Results or Responses
Is there a plugin for detecting forum access data?
How to show non-staff posts with zero replies
Viewing all published pages in a single site window
Accessing a user's chat activity
Configure Facebook login for Discourse
Admin Reporting & Analysis: Incremental Changes
Access to OpenID claims data?
How to calculate engagement rate for Discourse?
How to export more than the 10,000 limit?
`/admin/customize/permalinks` only shows ~100 permalinks
Can we delete all 'Automatically Bumped' msgs in one go?
User Status
Sort or Order post with combination of both (Replies + Activity)
Dynamically update available user field values during a profile fill in
Can I create a dashboard for a specific group inside the community?
Error during upgrading from Beta 3.1.x to latest
Must have plugins and components for Discourse?
Full IP access log
Available settings for global rate limits and throttling
How can I use GUI to access the postgresql db in docker
Data Explorer query for topics N+ days old, that are unsolved
Page Publishing
Tips for Exporting User Data
Identify private message interactions between users
View tag changes
Types of community & their characteristics
Discourse Chatbot :robot:
Run Data Explorer queries with the Discourse API
2023: The Year in Review
"Ensure ad-blockers are disabled and try reloading the page." when enabling Data Explorer
Exploring Discourse Data Explorer on my Sandbox
Order/Filter searched topics by latest update to First Post
Discourse Automation
API Filter users by emails, including secondary emails
How do I clear user warnings?
Exclude certain categories from the Trust Levels
Topic Ratings Plugin
Forum Data
Is it possible to view all staff notices?
Discourse Retort
Advice on archiving a site
Cleaning up uploads and purging uploads from S3
Content Audit : Report to pull Categories, Topics and Replies
Exporting all Forum Posts for Manual Upload into External LLMs?
discourse容器部署方式下,如何在外部连接到数据库,例如使用DBeaver连接
I'm attempting to merge user accounts
获取昨日点赞或者浏览量,前10的帖子
Populate Data Explorer params with URL params
AI sentiment and emotion analysis reports
Bulk Export of Raw Post Sources with Markup
Bundling more popular plugins with Discourse core
Setting up automated admin notice alerts
Listing event invitees with email addresses
More charting options for Data Explorer
Topics list filter feature
Migrate a phpBB3 forum to Discourse
Using Parameters in Data Explorer Queries
How to find how long a user has viewed a topic/who has posted new topics/country of users
Error trying to edit a post with an image in (NginX Proxy Manager?)
Restrict moderator access to only the stats panel on the admin dashboard?
How does auto-close topics work?
Poll: Export poll results in CSV for quiz creator?
Query to find out who marked the solution as solved
Possible to run a report for most posts within community?
Add an Admin subtab for Inactive users
Questions regarding Discourse features
How to query an email list of users that are not actived
Advice on a support forum
Shopify Integration
How do I see Facebook signups?
Creating and managing polls
Poll: Export poll results in CSV for quiz creator?
Discourse disk space limits per user?
Sorting all users by total posts?
SQL: The most N used words per user (speak their language!)
User Summary - Most Liked By user attributions are incorrect
Maximum Number of Search Results?
Get only top level posts in topic via discourse API
How to get all the deleted posts for a specific topic
Stats reports on a per-category basis?
Data analytics by complex networks and text mining
Error thrown when importing a query in Data Explorer
Zero search results searching private messages for specific keyword
A way to see full list of users granted with a certain badge?
Who messaged the most?
Who messaged the most?
How to open hyperlinks in a new tab
Run report of digest Unsubscribes
Need log the who downloaded attachments
Poll problem - exact vote numbers needed
Telegram Notifications Plugin (discourse-telegram-notifications)
Get last :heart: via API
Is it possible to keep the votes history of a poll?
How do I check a badge's status midway to it being awarded?
What plugins do you use - and why?
Export list of users based on date range
How to get all posts a user interacted with?
How can I email all recently active users?
Raw Function limited to 100