What SQL Query Workbench does
A SQL console for administrators that can only read: one SELECT, WITH or EXPLAIN at a time, on its own read-only connection, with a timeout and a row cap, always rolled back. Save queries with typed parameters, browse the schema, read query plans and export to CSV, Excel or PDF.
Strictly read-only SQL console for administrators: saved queries with typed parameters, schema browser, EXPLAIN plans, CSV/Excel/PDF export, sharing, query menus and email digests.
- Read only
- Typed parameters
- Schema browser
- Explain plans
- CSV, Excel, PDF
Features
Console with SQL highlighting
Ctrl+Enter runs, a selection runs alone, the draft is kept per user. Open saved queries by tag or recall a recent run.
Results grid
Row numbers, sticky header, column types, sorting, pagination, a filter box, hide and reorder columns, NULL highlighting, sum and average footer.
Open the real record
id and many2one columns read from an Odoo table link to the record form. Override the column-to-model mapping per saved query.
Schema browser
Tables with row estimate and size, columns with SQL type and Odoo field label, indexes and foreign keys. Insert a name or a ready SELECT into the editor.
Explain plan view
A readable plan tree with estimated and actual rows, time and cost share. Sequential scans on large tables are flagged. EXPLAIN ANALYZE stays read-only.
Saved queries
Name, notes, tags and SQL, validated by a read-only dry run before they can be shared. SQL changes are tracked in the chatter.
Typed parameters
Date, date and time, number, text, yes/no, selection, record and record list, with labels, required flags and defaults like start of month or fiscal year.
Share and publish
Share with groups or users: they run, they do not edit and do not see the SQL. Publish a query as a menu with a parameter form and export buttons.
CSV, Excel and PDF
CSV with separator, quote, header, BOM and line endings. Excel with real dates and numbers, frozen header and autofilter. PDF in portrait or landscape.
Email digests
Send a saved query daily, weekly or monthly as Excel or CSV to users and contacts, skipping empty results if you like.
History and run log
Every run is logged with user, duration, rows, status, error and parameters. List, pivot and graph views, and a retention job.
Safety settings
Row cap, timeout and export limit, with overrides per group. Blocked tables and columns, and masking of password, token and key columns.
Query library
Export saved queries with parameters and sharing groups to a JSON file and import them into another database.
Multi-company
Saved queries and run logs carry a company. Built-in values :company_id and :company_ids follow the companies selected by the user.
Ten example queries
Largest tables, installed modules, scheduled actions, the email queue and more, ready to run and copy.
How it works, step by step
01The console
Editor with SQL highlighting, schema browser on the left and the results grid with the type under each column name, row count and run time. A reminder that SQL reads raw data sits under the editor.

02Open a saved or recent query
Start a new query, pick a saved one filtered by tag, or recall one of your recent runs.

03Grid tools
A typed parameter box, hide and reorder columns, sorting, quick filter, NULL highlighting and copy.

04Schema browser
Columns with SQL type, Odoo field label and target model. The password column is masked in the grid, NULL values are highlighted.
05Explain plan
Estimated and actual rows, time and cost share per step. A sequential scan on a large table is flagged in yellow.
06Errors in place
The PostgreSQL message and hint appear under the editor and the line is marked. No traceback.
07Writes are refused
An UPDATE never reaches the database. Only SELECT, WITH and EXPLAIN can run.
08Saved queries
Tags, owner, sharing, run count and state, with a Run button on each line.
09Typed parameters
Dates with dynamic defaults, a country record list, a yes/no and a selection, each bound by the driver.
10Run screen for colleagues
A published query opens a parameter form and the results. Run-only users never see the SQL.
11Sharing and menus
Share a validated query with groups or users and publish it as a menu entry under SQL Reports.
12Change tracking
Every change to the SQL, parameters and sharing is written to the chatter.
Questions about SQL Query Workbench
Can a query change data?
No. Only one SELECT, WITH or EXPLAIN statement is accepted, it runs in a READ ONLY transaction on a separate connection, and the transaction is always rolled back. Functions with side effects, such as nextval() or file access, fail or are refused.
Who can use it?
Settings administrators by default. You can also give the SQL Workbench User role to a trusted person. Everyone else sees only the queries shared with them, without the SQL.
Do Odoo access rules apply to the results?
No. SQL reads the tables directly, so record rules, field groups and company filters are not applied. That is why access is limited and why sensitive tables and columns are blocked or masked. The console shows this warning under the editor.
What happens with a slow query?
PostgreSQL cancels it at the statement timeout (30 seconds by default) and the run is logged as a timeout. Results above the row cap are cut and flagged.
How do parameters work?
Write :date_from in the SQL and declare it as a date. The run form shows a date picker with the default you chose, and the value is passed to the database driver separately from the SQL. :user_id, :company_id, :company_ids, :today and :lang are filled in for you.
Can colleagues run my queries without seeing SQL?
Yes. Validate the query, share it with a group and optionally publish it as a menu. Members get a parameter form, the results and export buttons.
Does it create views or tables in the database?
No. Nothing is created in PostgreSQL. Saved queries are ordinary Odoo records.
Does it work on Odoo.sh or a managed database?
Yes. It needs no database superuser and no extra PostgreSQL role. It uses the connection Odoo already has.
Which apps does it need?
Only Discuss, for the chatter and email digests.
