pgmodeler icon indicating copy to clipboard operation
pgmodeler copied to clipboard

Diff takes over 20 minutes and crashes in the end

Open LKajan opened this issue 3 years ago • 1 comments

Bug description

Exclude overlapping constraint of range datatypes makes diff process extremely slow and causes crashing. I have the following table with exclude constraint that prevents overlapping reservations of the same meeting room.

CREATE EXTENSION btree_gist;
CREATE TABLE IF NOT EXISTS room_reservation(
    room int,
    during tsrange,
    CONSTRAINT excl_overlapping_reservations EXCLUDE USING gist (
      room WITH =,  
      during WITH &&
    )
);

If I try to use diff tool to get changes in the model I have to use "import system objects" and "import extension objects". This makes diff extremely slow and unusable imho. The diff run over 20 minutes with a local database. Especially recreating objects phase seems to be very slow. I also have a postgis extension installed in the database.

Is there anything to make diff process faster?

I'm not sure if this is another bug but the diff never even finishes. It crashes in the recreating objects phase with the following stacktrace.

[0] src/tools/modeldatabasediffform.cpp (849)
  void ModelDatabaseDiffForm::captureThreadError(Exception)
    [AsgNotAllocattedObject] Assignment of not allocated object!

[1] src/tools/databaseimporthelper.cpp (664)
  void DatabaseImportHelper::importDatabase()
    [AsgNotAllocattedObject] Assignment of not allocated object!

[2] src/tools/databaseimporthelper.cpp (525)
  void DatabaseImportHelper::createPermissions()
    [AsgNotAllocattedObject] Assignment of not allocated object!

[3] src/tools/databaseimporthelper.cpp (2513)
  void DatabaseImportHelper::createPermission(attribs_map&)
    [AsgNotAllocattedObject] Assignment of not allocated object!

[4] src/permission.cpp (33)
  Permission::Permission(BaseObject*)
    [AsgNotAllocattedObject] Assignment of not allocated object!

How to reproduce

  1. Create an empty database
  2. Install extensions postgis and btree_gist
  3. Create the sample table from above
  4. Import database to PgModeler
  5. Add some column to the table
  6. Run diff
  7. Wait

Expected behavior

  • Diff should be quite fast operation to make the process pleasant.
  • Diff should not crash in any situation

Info about your desktop

  • OS: Windows 11
  • pgModeler version: 0.9.4

LKajan avatar Feb 15 '22 12:02 LKajan

Hi @LKajan

Unfortunately, the diff process can be quite slow depending on the arrangement of the database being handled. I'm aware of this deficiency and I'm constantly improving this feature.

You can try to use the partial diff feature. In the diff dialog, use the tab "Partial diff" and create a filter that matches the table "room_reservation" only. I think it can help in the speed of the whole process.

Anyway, I'll try to reproduce it with your step-by-step. Also, Is there any chance for you to send me a dump of your database? :)

rkhaotix avatar Feb 15 '22 12:02 rkhaotix