We should check the query plan from sqlite/postgres, of course, but depending on how the indices were defined, this should be more efficient, due to reduced disk i/o and data transfer from disk to memory, since the query will be satisfied by only reading the values from the index, without needing to fetch additional data from the table. I imagine this would be the case as the following indices are defined in the code as far as i could see all the columns match the attributes that can be used as criteria in the store query requests:
Consider modifying the
getMessages
function in line 139 of https://github.com/waku-org/nwaku/blob/4e57308905158cff62f2616732867121c92b524f/waku/waku_archive/archive.nim to also pass theincludeData
value, and then, in the drivers define a query that will only do a SELECT messageHash FROM messages ....... if the value from includeData is true.We should check the query plan from sqlite/postgres, of course, but depending on how the indices were defined, this should be more efficient, due to reduced disk i/o and data transfer from disk to memory, since the query will be satisfied by only reading the values from the index, without needing to fetch additional data from the table. I imagine this would be the case as the following indices are defined in the code as far as i could see all the columns match the attributes that can be used as criteria in the store query requests: