what to do when your select query consist so many rows at a time ? How to reduce its impact on heap memory ?
-
i am executing select query with SQLITE3_EXEC function for 2104 records that contain multiple fields. this query execution take too much utilization of heap memory.
i don't know How to free heap or how to reduce the use of it ?
-
i am executing select query with SQLITE3_EXEC function for 2104 records that contain multiple fields. this query execution take too much utilization of heap memory.
i don't know How to free heap or how to reduce the use of it ?
@Qt-embedded-developer how is that qt related? please show your code.
Edit: from the top of my head though, quick fix (but might not be applicable to your situation) is to include "limit" clause in your query and process the data in the loop, in batches resulting from the said limit.
-
@Qt-embedded-developer how is that qt related? please show your code.
Edit: from the top of my head though, quick fix (but might not be applicable to your situation) is to include "limit" clause in your query and process the data in the loop, in batches resulting from the said limit.
@artwaw will it free my heap_max memory ?
-
@artwaw will it free my heap_max memory ?
@Qt-embedded-developer SQL LIMIT clause is not a memory manager.
Please read https://www.w3schools.com/sql/sql_top.asp -
@Qt-embedded-developer SQL LIMIT clause is not a memory manager.
Please read https://www.w3schools.com/sql/sql_top.asp -
@jsulm that was my suggestion. My thinking is that limiting the amount of returned data might preserve some memory, no? (depending on how the results are cached, of course, we don't know exactly how OP is handling the queries)
@artwaw said in what to do when your select query consist so many rows at a time ? How to reduce its impact on heap memory ?:
My thinking is that limiting the amount of returned data might preserve some memory, no?
Yes, of course. It reduces the amount of used memory, but it does not "free" memory, like freeing after using it.
I replied to "will it free my heap_max memory ?". -
i am executing select query with SQLITE3_EXEC function for 2104 records that contain multiple fields. this query execution take too much utilization of heap memory.
i don't know How to free heap or how to reduce the use of it ?
@Qt-embedded-developer
Apart from the suggestions for limiting rows returned, make sure you only request those columns you really need.I don't know whether the option has any effect when using SQLite, but do try setting QSqlQuery::setForwardOnly(bool forward). It could make a big difference to memory usage (and speed).