Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 946429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:54:50+00:00 2026-05-15T22:54:50+00:00

postgres 8.3 / Ubuntu Karmic / 32-bit (in virtualbox): duration: 76.534 ms statement: truncate

  • 0

postgres 8.3 / Ubuntu Karmic / 32-bit (in virtualbox):

  duration: 76.534 ms  statement: truncate audit.users cascade
  duration: 0.952 ms  statement: delete from audit.users

postgres 8.4 / Ubuntu lucid / 64-bit (native, on the machine hosting the karmic virtualbox):

  duration: 1469.271 ms  statement: truncate audit.users cascade
  duration: 0.988 ms  statement: delete from audit.users

So the DELETE statements are pretty much equivalent, but TRUNCATE takes 20x longer on one platform than the other. EXPLAIN doesn’t seem to work on TRUNCATE. How do I find out what’s taking so long?

Edited to add:

The above samples were taken when there was another idle connection open to the database, but no open transactions or other activity. I use TRUNCATE in the tearDown method of some automated tests, which is where I noticed the speed difference between platforms.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:54:51+00:00Added an answer on May 15, 2026 at 10:54 pm

    The way TRUNCATE works in PostgreSQL, it’s very sensitive to how fast your filesystem can delete blocks, as well as whether it correctly honors the fsync system call when you write to flush the write cache out. My guess is that you have different filesystem setups on the two systems. For example, if the Lucid install is using ext4 and the Karmic one ext3, this is unsurprising behavior. Newer kernels will correctly turn fsync calls into disk cache flushing via write barriers; older ones let the drives lie to them about things being written. This is a good thing in terms of keeping the database writes safe during a crash, but performance drops a lot when the kernel does the right thing from a reliability perspective.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Postgres query calculates statistical aggregate from a bunch of sensor readings: SELECT to_char(ipstimestamp,
I have installed PostgreSQL and pgAdminIII on my Ubuntu Karmic box. I am able
Somehow I've managed to completely bugger the install of postgresql on Ubuntu karmic. I
How can I find where Postgres 8.x database files are saved in Ubuntu 10.04
I'm using postgres, and I have a users table which contains users first and
New install of PostgreSQL and pgAdmin on Ubuntu 11.04 64-bit. On restoring a database
I got many datasources (postgres database, logfiles) containing statistic data or containing data from
I'm migrating Alfresco Community 4.0.b from Server 1 to Server 2. Both are Ubuntu
In postgres if I run the following statement update table set col = 1
I have a postgres table that has the following fields start_date,duration duration contains any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.