performance of Using QSqlQuery to access table containing blob coloumn
Hi,
As subject, i use QSqlQuery to access tableA which contains column storing blob data as follows,
Code:
while (query.next()) {
i++;
}
The speed of query is too slow which need about 5s to execute whole "while" loop, is there any idea to improved it? How to deal with blob?
Thanks!
Re: performance of Using QSqlQuery to access table containing blob coloumn
The Database must provide you with the entire contents of the table, although you are using for anything. Why are you surprised?
What is Yours real problem - what You want to do ?
Re: performance of Using QSqlQuery to access table containing blob coloumn
Quote:
Why? What can i do to make the former as fast as the latter?
Because the BLOB is probably big and it requires a huge amount of processing power to query all these rows from database into memory. If you don't select it in your query, then database driver will not load BLOBs into memory, which allows it to complete faster.
If you need to do some kind of processing on these rows then display a progress dialog or something. What is your task anyway ? I doubt you will increment an integer in your final code, if you give us more details then maybe we can help to optimize your code.
Re: performance of Using QSqlQuery to access table containing blob coloumn
Quote:
Originally Posted by
stampede
Because the BLOB is probably big and it requires a huge amount of processing power to query all these rows from database into memory. If you don't select it in your query, then database driver will not load BLOBs into memory, which allows it to complete faster.
If you need to do some kind of processing on these rows then display a progress dialog or something. What is your task anyway ? I doubt you will increment an integer in your final code, if you give us more details then maybe we can help to optimize your code.
Thank you firstï¼
I just want to select all the rows as fast as possible ,how to make it with QSqlTableModel?