Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QSqlTableModel slow fetch results



  • I found that QSqlTableModel is very slow when there is network delay. I use ms sql server and I found that after QSqlTableModel select() method is executed. I get all the data(the dataset is very small only 100 lines) I want. But if I get the value by row I found that it keeps on fetch from database which make the software very slow. If anyone have suggestion for this. Thanks



  • By the way if I use QSqlQuery and setForwardOnly. it is very fast. How can I fix this because QSqlTableModel is very convenient to a QTableView



  • I also found that in sql server profiler. If you get data from the model there will be sp_cursorfectch in the log. Why?? I think maybe qsqltablemodel is just useful in locat db like qsqlite. Has any one use qsqltablemodel with sql server??


Log in to reply