Ir al contenido
Odoo Menú
  • Inicia sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Inteligencia artificial
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de propiedades
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Comunidad
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Odoo Performance Discussion: Slow Deletes on Large Relational Models

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
performancepostgresqlpostgresodoo
4 Respuestas
1298 Vistas
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
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Autor Mejor respuesta

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
Descartar
Avatar
Ali Khalid
Mejor respuesta

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
Descartar
Avatar
Vraja Technologies
Mejor respuesta

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
Descartar
Avatar
Perz, ODOO_Aspirant
Mejor respuesta

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
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Odoo Performance Analysis: Bottlenecks in Deleting Large Relational Records
performance wizard postgresql postgres odoo
Avatar
0
abr 26
7
Odoo Performance Issue
performance postgresql odoo
Avatar
0
ene 17
6256
No passwd entry for user 'postgres' in odoo 12
postgresql postgres odoo odoo12
Avatar
1
dic 19
11658
Have You Faced Slow Pagination in Odoo List Views with Large Data?
postgresql odoo
Avatar
0
abr 26
872
Seeking Odoo Server Performance configuration/ advice / tips / benchmarks for 60 concurrent users
performance postgresql workers tuning odoo
Avatar
0
mar 24
6442
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Sitio web hecho con

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