Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions database_size/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=============
Database Size
=============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:668760118d49181b67bfaaf0ccd66fe357de7d42d672a2c928c6bf7dd551644e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/19.0/database_size
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-19-0/server-tools-19-0-database_size
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Monitor the size of your Odoo instance.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you can review the scheduled action called
'Take model size measurements' and check the time at which you want it
to run. It should only run once a day. If it runs more often, it just
updates the existing set of sizes for the day.

You may also review the Database Size settings in Odoo's general
settings and enable 'Purge Older Model Size Measurements'. This task
will by default delete most daily data older than a year except for the
data captured on the first day of each month. These retention periods
can be configured here as well.

Usage
=====

You can use this module to keep an eye on the development of the size of
your Odoo instance over time. Every day, a snapshot will be taken with
the full size of the database and the attachments. You can query these
daily snapshots, and you can compare the current size with a size at any
date of the past for which there is data.

Enable debug mode, then go to menu Settings -> Technical -> Database
Size.

|image1|

The data that is gathered and that is displayed are:

- Model Name - The name of the model to which the data is related
- Estimated Rows - The number of estimated rows according to the
Postgresql query planner. For performance reasons, taking the data
from the planner is preferred over doing an actual count, although the
results may be imprecise.
- Bare Table Size - The disk usage of the model table without indexes
etc.
- Index Size - The disk usage of the indexes in the model table.
- Many2many Tables Size - The disk usage of related many2many tables,
including their indexes. To prevent double counts, many2many tables
are only correlated with one of their tables (the largest of the two).
- Attachment Size - The disk usage of the attachments linked to the
model records. Because Odoo will deduplicate attachments by content,
attachments with the same content may be counted double in the
attachment size of other models, but will not be counted double when
linked to records of the same model more than once.
- Total Table Size - Bare Table Size + Index Size
- Total Database Size - Total Table Size + Many2many Tables Size
- Total Model Size - Total Database Size + Attachment Size

If you click on individual records, you can inspect the sizes of each
index and many2many table.

All sizes are in megabytes.

In the 'Compare Size per Model' report view, you can find these data
twice: once for the selected measurement date (default: today), and once
for the selected comparison date (default: one month ago).

|image2|

If you want to compare arbitrary dates, you can start typing the date in
the search box. Be sure to enter the dates in the right format for your
localization.

|image3|

.. |image1| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/database_size/static/images/model_size.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/database_size/static/images/compare_model_size.png
.. |image3| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/database_size/static/images/select_date.png

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20database_size%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Opener B.V.

Contributors
------------

- Stefan Rijnhart <stefan@opener.amsterdam>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/19.0/database_size>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions database_size/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import report
24 changes: 24 additions & 0 deletions database_size/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2025 Opener B.V. <https://opener.amsterdam>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Database Size",
"version": "19.0.1.0.0",
"author": "Opener B.V.,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-tools",
"depends": ["base_setup"],
"license": "AGPL-3",
"category": "Tools",
"data": [
"data/ir_cron_data.xml",
"security/ir.model.access.csv",
"views/ir_model_size_views.xml",
"views/res_config_settings_views.xml",
"report/ir_model_size_report_views.xml",
],
"assets": {
"web.assets_backend": [
"database_size/static/src/scss/list_view_wrap_header.scss",
]
},
"installable": True,
}
11 changes: 11 additions & 0 deletions database_size/data/ir_cron_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo noupdate="1">
<record id="ir_cron_ir_model_size_measure" model="ir.cron">
<field name="code">model._measure()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="model_id" ref="model_ir_model_size" />
<field name="name">Take model size measurements</field>
<field name="state">code</field>
</record>
</odoo>
Loading
Loading