FetchMore with ODBC driver extremely slow

  • Populating a QSqlQueryModel with a large database table consisting over 100k rows is extremely slow. If I use:

    while (this->canFetchMore())

    A database table consisting over 100k rows is pretty much never loaded fully, because the it get's slower and slower to get the next 256 rows. The first 20k or so is fetched reasonably fast, but after that it get slower and slower and slower, eventually slowing so much it pretty much halts.

    Does anyone have any experience on this? I'm using the ODBC driver that I built from Qt sources. I found a post with Google which says:

    "So the problem comes from the QODBCResult behaviour. I downloaded Qt's Sources, and edit odbc driver. For those interrested in it, you need to change the behaviour of QODBCResult::data(int) and at least QODBCResult::fetch(int) (and maybe QODBCResult::fetchprevious/next/last/first if you really want something clean) functions.

    I personnally add a QList buffer, where I store my rows when they are requested. It's almost the same behaviour as Qt (since it don't cache everything but only the requested rows). My app take up to 38-40 Mbs in memory for 22k rows / 55 columns of text and floats in cache."

    I looked at the sources, but I must say I can't really see how to optimize it, not enough skills as of yet... :) Can someone help me, maybe someone has come across the same issue?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.