Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • E-learning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Artificiële Intelligentie
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelwinkel
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Horeca & Hospitality
    • Bar en café
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van mede-eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brouwerij
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Diensten
    • Klusjesman
    • IT-hardware & ondersteuning
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Alle bedrijfstakken bekijken
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijsprogramma
    • Scale Up! Business Game
    • Odoo bezoeken
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Partner worden
    • Diensten voor partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Odoo Performance Discussion: Slow Deletes on Large Relational Models

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
performancepostgresqlpostgresodoo
4 Antwoorden
1299 Weergaven
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Hi Odoo Community,

We are currently exploring ways to improve database performance in Odoo, and we would like to better understand real-world challenges faced by users.

One area we are particularly interested in is slow deletion performance in models with many relational fields and foreign key dependencies.

  • Have you encountered slow record deletions  in Odoo, especially in models with multiple relationships (Many2one, One2many, etc.)?
  • Does deleting large volumes of data (such as during cleanup, archiving, or module uninstallation) take a noticeable amount of time?
  • Have you observed delays caused by cascade deletions or foreign key constraint checks?
  • If yes, how are you currently handling these situations? (e.g., batching, custom scripts, raw SQL, or other workarounds)

We are trying to understand:

  • How frequently this issue occurs in real-world Odoo deployments
  • At what data scale it starts becoming a bottleneck

Your feedback and real-world experiences would be extremely valuable in helping us identify practical requirements for improving Odoo performance.

Regards

0
Avatar
Annuleer
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Auteur Beste antwoord

Hi,


We’ve found a solution for this issue while working on PostgreSQL-level optimizations specifically for Odoo workloads, and we observed that foreign key validation was a major bottleneck during large delete operations.

In Odoo, many core models contain deep relational dependencies (`Many2one`, `One2many`, cascading deletes, computed relations, etc.). When deleting large datasets or uninstalling modules, PostgreSQL must repeatedly validate foreign key constraints and trigger cascade checks across multiple related tables.


From our benchmark testing across multiple PostgreSQL versions (15, 16, 17, and 18), we noticed that:


* Foreign key trigger validation time increases significantly with large relational datasets

* Missing or inefficient indexes on foreign key columns heavily impact deletion speed

* Cascade delete operations become slower as dependency depth and row count increase

* Module uninstallation in Odoo can become extremely slow when tables contain millions of related records


Based on these observations, we believe there are two important optimization areas:


1. Improving Foreign Key Validation Performance in PostgreSQL


We are currently exploring PostgreSQL source-level optimizations to reduce the overhead of FK trigger validation during delete and update operations.


Since Odoo relies heavily on relational integrity, optimizing FK checks could significantly improve:


* Bulk deletions

* Module uninstallations

* Cleanup operations

* Archiving workflows

* Large transactional updates


Our internal testing indicates that FK validation overhead becomes much more visible at multi-million row scale deployments.


2. Automatic Index Suggestion for Foreign Key Columns


Another major issue we observed is that many slow deletions are caused by missing indexes on foreign key columns.


Although PostgreSQL automatically indexes primary keys, foreign key columns themselves are not automatically indexed. In Odoo deployments with large relational datasets, this can cause expensive sequential scans during FK validation.


We are exploring an automatic index suggestion mechanism that could:


* Detect heavily-used FK columns

* Suggest or create optimized indexes for relational operations

* Improve delete/update validation speed

* Reduce cascade operation cost

* Improve overall ORM performance in Odoo


In many cases, proper FK indexing alone noticeably reduced deletion time during our tests.


We believe combining:


* FK validation optimization

* Better relational indexing strategies

* Odoo-specific workload tuning


could significantly improve PostgreSQL performance for large-scale Odoo environments.


It would be very interesting to know:


* At what table size users start seeing deletion slowdowns

* Which Odoo modules are most affected

* Whether the issue occurs mainly during module uninstallations, scheduled cleanups, or normal business operations


Regards

0
Avatar
Annuleer
Avatar
Ali Khalid
Beste antwoord

Yes, I've faced this exact issue. Slow deletions become a bottleneck past 50K records with heavy relational fields. Cascade deletes and FK constraint checks easily take 30+ seconds for just 10K records.

I see it regularly during:

  • Module uninstalls (ir.model.data cascades)

  • CRM campaign cleanups

  • Stock move archiving

My current approach:

  • Batch unlink: records[0:1000].unlink() via cron job (~80% faster)

  • Raw SQL: DELETE FROM model WHERE id IN (...) + VACUUM ANALYZE

  • Archive first: Set active=False, then purge later

This keeps things manageable up to 1M records with proper indexing.

0
Avatar
Annuleer
Avatar
Vraja Technologies
Beste antwoord

Yes In So many Cases Like Delete Product (In Link With Sale Order,Invoice,Inventory,Picking etc) 

uninstalling a custom module after it has been used for months or years. it'getting long time to uninstall because of lot's of relation and business data.

Right now We are handling this way.

The First Way is Archive the Records
For ex Products
It's link to stock,sales,purchase,invoice

so it's hard to delete
faster than deep delete chains
=================================
Another Option is
Delete child/dependent records first

Do not always rely only on cascade deletion.

Better approach:

identify dependent models
remove deeper child records first
then delete parent records

=================================
Raw SQL can be faster, but should be used only when:

cleanup of temporary import tables
large log/history cleanup
Avoid For Stock and Accounting entries

I hope this will help for you. please give feedback/suggestion.

Thanks


0
Avatar
Annuleer
Avatar
Perz, ODOO_Aspirant
Beste antwoord

In general " DELETION " of data is not a recommended solution

Other alternatives :

CHeck the indexes  - implement  wherever you need

In case if you use any third party security apps

If it is .sh environment - you can consider  to " move the attachment to a shared location"  - So ODOO will have url o nly -when user click only document will load

-1
Avatar
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Odoo Performance Analysis: Bottlenecks in Deleting Large Relational Records
performance wizard postgresql postgres odoo
Avatar
0
apr. 26
7
Odoo Performance Issue
performance postgresql odoo
Avatar
0
jan. 17
6256
No passwd entry for user 'postgres' in odoo 12
postgresql postgres odoo odoo12
Avatar
1
dec. 19
11662
Have You Faced Slow Pagination in Odoo List Views with Large Data?
postgresql odoo
Avatar
0
apr. 26
872
Seeking Odoo Server Performance configuration/ advice / tips / benchmarks for 60 concurrent users
performance postgresql workers tuning odoo
Avatar
0
mrt. 24
6442
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Partner worden
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now