-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mixed chart query optimisation #1690
Mixed chart query optimisation #1690
Conversation
to avoid recomputing the entire vouts on every chart update
for continuation during subsequent anonymity set computation
to work with height offset
Thanks for the quick response on this @ademuanthony! I'm glad you see the issue, and I appreciate your follow-through. Your mix charts work has been very good. Just a bit more code formatting to make CI happy. Note that prior to merging the fix, I'll have to instrument a few functions to provide timing data. It would be helpful if you could do the same and provide before and after values. |
This is the information from the planentdecred dev server After: |
Thanks for the timings. I'm going to look into the query on my end however. 25 second is still to high, by a lot unfortunately. |
In my new update on this PR, I have changed the process of the anonymity set computation to only fetch data from the database during first load and whenever there is a length mismatch in the chart data. Otherwise, I used the in coming mixed output and their spending notification to maintain the value of the running anonymity set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, and sorry for the extremely long delay.
I have a few items for refactoring that I will follow up on myself since I took forever with this PR:
InsertVoutsStmt
should ideally not take the block height since it is not stored or used for the query, and maybe should not be callingappendNewVoutsToCharts
.(*ChainDB).storeTxns
has what it needs (the vouts) if the db row id is substituted for another key for the vout.- Instead of using
voutDbIds
key the_charts.UnspentOutputs
map (a field of a type in db/cache), should key the map based on txid:out or other unique identifier. - The package-level
_charts
variable should be avoided if possible. Only a couple fields of it are used too. &sql.Rows{}
looks like it could be a problem. What happens withrows.Next()
for a zero valueRows
?
I'm also still seeing ValidateLengths errors, even after removing the old gob file. e.g.:
[WRN] PSQL: charts.ValidateLengths: dataset at index 2 has mismatched length 437622 != 437621
[WRN] PSQL: charts.ValidateLengths: dataset at index 3 has mismatched length 437622 != 437621
[WRN] PSQL: charts.ValidateLengths: dataset at index 10 has mismatched length 437622 != 437621
[WRN] PSQL: ChartData.Lengthen: block data length mismatch detected. Truncating blocks length to 437621
Fix #1689
This PR adds a height constraint to the query that fetches vouts for computing anonymity set.