[QODBC-Desktop] & [QRemote-Desktop] - Optimizing QRemote Performance for Large Table Queries (Invoiceline, Transaction, and Other High-Volume Tables)
Problem Description:
When using QRemote (QODBC remote driver) to query large tables - such as Invoiceline, InvoiceLine, Transaction, or other high-volume data sets - users may experience one or more of the following:
- Queries appear to hang or take an extremely long time (e.g., over an hour for 300K+ records).
- Only a subset of records is returned (e.g., 64K out of 346K rows from the
InvoiceLine table).
- Queries run significantly slower when executed through QRemote compared to running them locally via the QODBC Test Tool on the QuickBooks machine.
Affected products: QODBC QRemote, QuickBooks Desktop, QuickBooks Online Expected outcome: After adjusting Iterator Chunk Size, Optimizer read mode, and applying date-range filters, large queries complete in a reasonable time with all expected records returned.
Symptoms:
- A query on a large table (e.g.,
SELECT * FROM InvoiceLine) takes an unusually long time to execute - sometimes over 30 minutes or more.
- Only a partial set of records is returned (e.g., 64K rows when the table contains 346K).
- The same query runs in under 10 seconds on the QuickBooks machine via the QODBC Test Tool, but takes 50+ seconds from a remote SQL Server.
- Using the Optimizer set to "Real-Time" mode makes queries significantly slower than when set to "Null" or "Dirty Reads."
Cause:
The performance degradation is caused by a combination of factors inherent to how QRemote, the QODBC Optimizer, and QuickBooks SDK interact when processing large data sets remotely.
1. QRemote Remote Access Overhead (Known Bug B01677)
QRemote has a known performance issue (internal bug B01677) where queries executed through the QRemote server are significantly slower - up to 10× slower - than equivalent queries run directly on the QuickBooks machine via the QODBC Test Tool. This is due to network and communication overhead between the remote SQL Server and the QRemote server.
2. Optimizer Real-Time Mode
When the Optimizer is set to Real-Time mode, each query fetches data directly from QuickBooks (or the QODBC Online source) instead of reading from the local cached cache. For large tables, this dramatically increases the number of SDK calls required.
3. Iterator / Chunk Size Limitation
QuickBooks SDK processes records in chunks (batches). The default Iterator Chunk Size is 500, meaning QuickBooks SDK retrieves 500 records per request. For very large tables, the cumulative effect of these chunked requests slows down data retrieval.
4. Full Table Scans
Running SELECT * FROM TableName on a large table without any date or row filters forces QuickBooks to process every single record in that table. For tables like InvoiceLine (which can contain hundreds of thousands of rows), this is inherently slow - especially over a remote connection.
Bug Reference
This issue is tracked as B01677 on the QODBC internal bug list. A fix is pending; no estimated timeline has been provided.
Environment:
| Product | Version / Detail |
| QODBC QRemote |
All versions |
| QODBC Desktop |
All versions (when running on the same machine as QuickBooks) |
| QuickBooks Desktop |
All editions (Enterprise, Pro, Premier) |
| QuickBooks Online |
All plans |
| SQL Server |
Any edition used as the remote data consumer |
Solution:
- Adjust the Iterator / Chunk Size in the QODBC Advanced Settings. Open the QODBC Setup Screen: Start → All Programs → QODBC Driver for QuickBooks → Configure 32-Bit QODBC Driver → System DSN → QuickBooks Data (or QRemote) → Advanced tab. Change the Iterator / Chunk Size from the default (500) to a higher value such as 10/20 or 50. Lowering the iterator size means QuickBooks and QODBC both have to process fewer records at a given time
Note: If you increase the iterator size, QuickBooks and QODBC have to hold that much data in memory, which usually is slower.
- Change the Optimizer mode from "Real-Time" to "Null" or "Dirty Reads." Navigate to the Optimizer tab in the QODBC Setup Screen and change the data sync option:
- Null: Returns NULL for fields that cannot be synchronized immediately. Fastest option.
- Dirty Reads: Returns the most recent value stored in the Optimizer cache. Very fast, suitable for read-only reporting.
- Avoid "Real-Time" for large query sets. Real-Time mode fetches data directly from QuickBooks on every query, which is slow and unnecessary for reporting scenarios.
- Apply date-range filters to all large-table queries. Instead of querying an entire table, filter by
TxnDate or another date field:
SELECT * FROM InvoiceLine WHERE TxnDate >= {d'2026-01-01'} AND TxnDate <= {d'2026-05-01'}
Date-range filtering can dramatically reduce the number of records processed, often reducing query time from hours to seconds.
- Use UNOPTIMIZED queries when Optimizer corruption is suspected. If you suspect the Optimizer cache is stale or corrupted, run the same query with the
UNOPTIMIZED keyword as a diagnostic step:
SELECT * FROM InvoiceLine UNOPTIMIZED
If the UNOPTIMIZED query returns all expected records and completes in a reasonable time, rebuild the Optimizer cache (see below).
- Rebuild the Optimizer cache. If the Optimizer is suspected of being stale or corrupted:
- Delete the Optimizer file(s): How to Remove the Optimizer File
- Rebuild using QODBC Setup Screen → Optimizer → Reload All Data, or run:
sp_optimizefullsync ALL
- For routine incremental updates (once per day), use:
sp_optimizeupdatesync ALL
- Disable Detail Tracing (Slow) on all QODBC and QRemote components. Ensure the following have Detail Tracing (Slow) disabled, as it can significantly slow down query performance:
- QODBC 32-Bit DSN → Messages tab
- QODBC 64-Bit DSN → Messages tab
- QRemote Client → Advanced tab
- QRemote Server → File → Settings → Messages tab
- Test with QODBC Test Tool from the remote SQL machine. Execute your query using the QODBC Test Tool directly on the remote SQL Server (not the QuickBooks machine) to validate performance:
SELECT * FROM OPENQUERY([QUICKBOOKS], 'SELECT * FROM InvoiceLine WHERE TxnDate >= {d''2026-01-01''}')
Local QODBC vs. QRemote Performance
Queries executed on the same machine as QuickBooks (via the QODBC Test Tool) will always perform faster than those run from a remote SQL Server via QRemote, due to:
- Network latency between the remote server and the QuickBooks machine.
- Additional communication overhead in the QRemote protocol.
- QuickBooks SDK limitations on processing concurrent requests.
SQL Examples:
Benchmark test - local QODBC Test Tool (on QuickBooks machine):
SELECT * FROM InvoiceLine WHERE TxnDate >= {d'2026-01-01'} AND TxnDate <= {d'2026-05-01'}
Typical execution time on QuickBooks machine: ~6–10 seconds with Optimizer set to Dirty Reads.
Benchmark test - QRemote from remote SQL Server:
SELECT * FROM OPENQUERY([QUICKBOOKS], 'SELECT * FROM InvoiceLine WHERE TxnDate >= {d''2026-01-01''} AND TxnDate <= {d''2026-05-01''}')
Typical execution time via QRemote: ~30–90 seconds (with Optimizer Dirty Reads and adjusted Iterator Chunk Size).
Alternative - using OPENQUERY without nested date filtering:
SELECT * FROM QRemote...InvoiceLine WHERE TxnDate >= {d'2026-01-01'} AND TxnDate <= {d'2026-05-01'}
Diagnose with UNOPTIMIZED:
SELECT * FROM InvoiceLine UNOPTIMIZED
Example Scenarios:
Scenario 1 - Pulling all InvoiceLine records for a fiscal year:
A business uses QRemote to pull InvoiceLine data nightly from QuickBooks Desktop into SQL Server. Without optimization, the query took over 1 hour and returned incomplete results. After applying the following changes:
- Iterator Chunk Size increased from 500 to 200
- Optimizer changed to Dirty Reads
- Date-range filter applied (one fiscal year at a time)
The query completed in under 60 seconds with all records returned.
Scenario 2 - Comparing local vs. remote performance:
A user ran the same InvoiceLine query on both the QuickBooks machine (via QODBC Test Tool) and a remote SQL Server (via QRemote). Results: ~10 seconds locally vs. ~50 seconds remotely. This difference is expected due to network overhead, confirmed by internal testing.
Additional Notes:
- Patch status: Bug B01677 (QRemote slow performance) has a fix in development but no ETA as of the last update. Use the workarounds above until a patch is released.
- ETL strategy: For large initial loads, consider pulling data once per fiscal year or per quarter after an initial full load, then using incremental updates for new and changed records only.
- Iterator Chunk Size trade-off: Higher values reduce round-trips but increase memory usage. Start with 1,000–2,000 and test in your environment. Do not exceed 5,000 without testing.
- Optimizer mode selection: Use "Null" or "Dirty Reads" for reporting scenarios where slightly stale data is acceptable. Use "Real-Time" only when absolute data freshness is required (e.g., order entry validation).
- VM considerations: Running QuickBooks and QODBC on virtual machines can introduce additional latency. Ensure adequate network bandwidth between the VM hosting QuickBooks and the remote SQL Server.
Related Articles:
How to Setup QODBC Optimizer and Where Are the Optimizer Options Troubleshooting: Slow Performance / Cannot Get Full Records from QuickBooks Understanding QODBC Iterator Chunk Size Slow Query Performance After Upgrading QODBC How to Remove the Optimizer File
Keywords:
QRemote Large Query InvoiceLine Iterator Chunk Size Optimizer Dirty Reads Null Reads Real-Time UNOPTIMIZED OPENQUERY Linked Server SQL Server Slow Performance Date Filter TxnDate B01677 Remote Access QuickBooks SDK sp_optimizeupdatesync sp_optimizefullsync
Support Tickets: QNX-232-28874, KGI-710-69314
|