PG Database Data table exception hangs

Source: Internet
Author: User
Tags postgresql

The PG database is the PostgreSQL database.

A few days ago in a Java project, the data table exception hangs for the PG database after running the Java program. And it appears on a computer, reloading the database is useless, the other computers can not reproduce, is a very strange phenomenon.

The main performance of the exception hangs is:

1. Using Pgadmin to select the appropriate table will result in pgadmin not responding and cannot be recovered for a long time.

2, using pgadmin Direct SQL command additions and deletions can not be executed, the execution took time from dozens of milliseconds to a few minutes, is expected to continue to grow.

3, only restart the PostgreSQL service in order to let the abnormal data table return to normal, restore to both can be selected, but also through the SQL statement additions and deletions to the search.

Finally, it is determined that because Java uses the TRUNCATE command to clear the data table operation caused the data table exception hangs, and then replaced the truncate command with the Delete command is OK.

During the troubleshooting process, you can use the truncate command in Pgadmin to directly clean up the table where the exception occurs, and to reproduce the previous problem, and delete is used normally.

The difference between truncate, delete, and drop is attached below: the difference between drop, truncate, and delete

As for this special case, why does the truncate cause the data table to hang, I have not thought to understand, hoped that the person who knows can help to guide the maze.

PG Database Data table exception hangs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.