Skip to content

DOLT 1.79 got Poor Performance over JOIN Operations #10235

@abulus

Description

@abulus

Dolt 1.79.1 (and 1.76.0) experiences severe performance degradation with JOIN queries that trigger partition scans, causing queries to hang for 60+ seconds. The same queries work fine in Dolt 1.43.11

Example Query Demonstrating the Issue

Minimal Reproducible Example

-- Setup
CREATE TABLE sku (
    id INTEGER PRIMARY KEY AUTO_INCREMENT,
    sku_name VARCHAR(255) UNIQUE
);

CREATE TABLE annotation (
    id INTEGER PRIMARY KEY AUTO_INCREMENT,
    shelf_image_id INTEGER,
    sku_id INTEGER,
    points JSON,
    INDEX idx_shelf_image_id (shelf_image_id),
    FOREIGN KEY (sku_id) REFERENCES sku(id)
);

INSERT INTO sku (sku_name) VALUES ('SKU_1'), ('SKU_2');
INSERT INTO annotation (shelf_image_id, sku_id, points) 
VALUES (1, 1, '{"top_left": [0,0], "bottom_right": [100,100]}');

-- ❌ PROBLEMATIC: Hangs in Dolt 1.79.1 (482+ seconds, never completes)
SELECT 
    a.id,
    a.shelf_image_id,
    a.sku_id,
    s.sku_name
FROM annotation a
JOIN sku s ON s.id = a.sku_id
WHERE a.shelf_image_id = 1;

-- ✅ WORKS: Completes in <2 seconds in both versions
SELECT 
    a.id,
    a.shelf_image_id,
    a.sku_id
FROM annotation a
WHERE a.shelf_image_id = 1;

Observed Behavior

Dolt 1.79.1:

  • Query state: sku(sku (0/? partitions)) - stuck in partition scan
  • Execution time: 482+ seconds (query never completes, must be killed)
  • Process list shows query running indefinitely

Dolt 1.43.11:

  • Query completes normally
  • Execution time: <2 seconds
  • Uses indexes properly

Results

Dolt Version Query (with JOIN) Query (without JOIN) Notes
1.43.11 ✅ <2s ✅ <2s Works correctly
1.76.0 ❌ 62s timeout ✅ <2s JOIN causes partition scan
1.79.1 ❌ 60+ seconds (hangs) ✅ 2.2s JOIN causes partition scan

Questions

  1. Why does Dolt 1.79.1 choose partition scan over index for JOIN queries when indexes exist?
  2. Is this a known regression from 1.43.11 to 1.79.1?
  3. How can we force index usage for JOIN queries?

Environment

  • Dolt Version: 1.79.1 (also observed in 1.76.0)
  • Image: dolthub/dolt-sql-server:1.79.1
  • Indexes: annotation(shelf_image_id) exists, sku(id) is primary key

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions