Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Kecerdasan Buatan
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Manajemen Properti
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Konsultasi
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Odoo Performance Discussion: Slow Deletes on Large Relational Models

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
performancepostgresqlpostgresodoo
4 Replies
1293 Tampilan
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
Buang
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Penulis Jawaban Terbai

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
Buang
Avatar
Ali Khalid
Jawaban Terbai

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
Buang
Avatar
Vraja Technologies
Jawaban Terbai

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
Buang
Avatar
Perz, ODOO_Aspirant
Jawaban Terbai

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
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
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
6251
No passwd entry for user 'postgres' in odoo 12
postgresql postgres odoo odoo12
Avatar
1
Des 19
11646
Have You Faced Slow Pagination in Odoo List Views with Large Data?
postgresql odoo
Avatar
0
Apr 26
863
Seeking Odoo Server Performance configuration/ advice / tips / benchmarks for 60 concurrent users
performance postgresql workers tuning odoo
Avatar
0
Mar 24
6427
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Karir
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah software terintegrasi dengan 70+ aplikasi seperti CRM, Akuntansi, Inventaris, Sales, eCommerce, Marketing, POS; plus fitur lokal Indonesia!

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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