Hola Gustavo el truncate trunca la tabla, lo que creo que hace fisicamente es que marca el primer registro como fin de archivo, de manera tal que cuando lee la tabla lee 0 registros. Lo mismo debe hacer con los indices, de manera tal que es una operacion muy rapida. de: http://www.postgresql.org/docs/9.1/static/sql-truncate.html fijate lo que dice aca: Notes
You must have the TRUNCATE privilege on a table to truncate it. TRUNCATE acquires an ACCESS EXCLUSIVE lock on each table it operates on, which blocks all other concurrent operations on the table. When RESTART IDENTITY is specified, any sequences that are to be restarted are likewise locked exclusively. If concurrent access to a table is required, then the DELETE command should be used instead. TRUNCATE cannot be used on a table that has foreign-key references from other tables, unless all such tables are also truncated in the same command. Checking validity in such cases would require table scans, and the whole point is not to do one. The CASCADE option can be used to automatically include all dependent tables — but be very careful when using this option, or else you might lose data you did not intend to! TRUNCATE will not fire any ON DELETE triggers that might exist for the tables. But it will fire ON TRUNCATE triggers. If ON TRUNCATE triggers are defined for any of the tables, then all BEFORE TRUNCATE triggers are fired before any truncation happens, and all AFTER TRUNCATE triggers are fired after the last truncation is performed and any sequences are reset. The triggers will fire in the order that the tables are to be processed (first those listed in the command, and then any that were added due to cascading). salu2 jmdc 2013/7/1 Gustavo Hernández Delgado <gustavo.hernan...@etecsa.cu> > > Saludos a todos: > > Tengo una curiosidad: qué pasa cuando se hace un truncate a una tabla que > está siendo consultada por muchas personas, o sea me gustaría saber qué > hace postgres, por ejemplo va borrando artículos no consultados y así > sucesivamente hasta que borra todo, etc > > gracias > > > --- > This message was processed by Kaspersky Mail Gateway 5.6.28/RELEASE > running at host imx3.etecsa.cu > Visit our web-site: <http://www.kaspersky.com>, <http://www.viruslist.com> > > - > Enviado a la lista de correo pgsql-es-ayuda (pgsql-es-ayuda@postgresql.org > ) > Para cambiar tu suscripción: > http://www.postgresql.org/mailpref/pgsql-es-ayuda > >