InfluxDB.Client.Net icon indicating copy to clipboard operation
InfluxDB.Client.Net copied to clipboard

GetInfluxDBStructureAsync seems to be inneficient in some cases

Open SkyGTRx5 opened this issue 4 years ago • 3 comments

Hi, recently you've made an update and closed my open issue about the most convinient way to count the entries. So, now it's possible to receive all detailed database structure using GetInfluxDBStructureAsync(dbName) on client. But I think this is kinda inneficient in cases, when I want to get only the details for particular measurement, since it provides a lot redundunt info for others and, what the most important, this operation is quite expensive in terms of time consuming. It calculates the data for all the measurements, but I suppose, the more common task is just to get the info for particuar one. Maybe its reasonable to create a method like GetMeasurmentDetailsAsync(string dbName, string measurementName).

SkyGTRx5 avatar Oct 14 '19 12:10 SkyGTRx5

That is the idea, in the v1.0 of the library I am planning to move few of these methods to their individual IInflux objects, so IInfluxMeasurement will have a method to get this data for itself. Also keep in mind Influx measurements are child of retention policy, not database. So you can have different Measurements with same name under different retention policies, so all of these methods have to take that into consideration too. For now please use the GetInfluxDBStructureAsync

mvadu avatar Oct 15 '19 03:10 mvadu

So, I tried to use it, replaced my previous implementation of counting entries and it... just confirmed my concerns. This method is almost useless in case of having big database. For instance, we have dozens of measurements and many of them contain from one to several millions entries, so receiving the database structure takes unacceptable amount of time(honestly I just stopped my unit test after 2 minutes of waiting on getting the database structure line). In case of my previous implementation this test passes for about 700ms

SkyGTRx5 avatar Oct 16 '19 21:10 SkyGTRx5

Give me few days, I will push an intermediate version with just this part of refactored code.

mvadu avatar Oct 16 '19 21:10 mvadu