Downloading Historical Data
Downloading Historical Data
Hi,
Is it possible to download historical data from the portal (ie the data used to make the graphs)?
Thanks
Fanie
Is it possible to download historical data from the portal (ie the data used to make the graphs)?
Thanks
Fanie
Re: Downloading Historical Data
Up to 7 days
You can get a json stream. Does it work for you?
You can get a json stream. Does it work for you?
Roberto.
Re: Downloading Historical Data
Hi Roberto, yup I think it would, how do I download the Json data?
Regards
Fanie
Regards
Fanie
Re: Downloading Historical Data
Code: Select all
http://forum.reefangel.com/status/jsonp.aspx?id=reefangel&filter=t1
Roberto.
Re: Downloading Historical Data
What is the main bottleneck in jsonp.aspx? Around 20s for a request feels like a long time.
Re: Downloading Historical Data
+1 it does take a long time to get the values for any of the charts too... Would love to see if this can be improved
Re: Downloading Historical Data
I think it is the server or the db structure
It was way worse in the past. I've made a few changes from recommendations of other members and it got better, but I also agree that it could be improved.
We just need someone that knows DB structure and optimization to really dig and take a look at it.
It could be the aspx page that is causing this too, in which case, we would need someone with vb.net knowledge to optimize it for us.
It was way worse in the past. I've made a few changes from recommendations of other members and it got better, but I also agree that it could be improved.
We just need someone that knows DB structure and optimization to really dig and take a look at it.
It could be the aspx page that is causing this too, in which case, we would need someone with vb.net knowledge to optimize it for us.
Roberto.
Re: Downloading Historical Data
Is the source available somewhere?
Re: Downloading Historical Data
I think it is much more of db optimization than anything else.
Here is the test I have done.
This query takes 9 seconds:
And this takes 0.14 seconds:
Here is the test I have done.
This query takes 9 seconds:
Code: Select all
select logdate, tags.name, data from reefangelportal_dbo.datalog inner join reefangelportal_dbo.datatagslog on datalog.id=datatagslog.datalogid inner join reefangelportal_dbo.tags on datatagslog.tagsid=tags.id where myreefangelid='reefangel' and logdate>='2014-07-21' and tags.name = 'T1'
Code: Select all
select logdate, tags.name, data from reefangelportal_dbo.datalog inner join reefangelportal_dbo.datatagslog on datalog.id=datatagslog.datalogid inner join reefangelportal_dbo.tags on datatagslog.tagsid=tags.id where myreefangelid='reefangel' and logdate>='2014-07-21'
Roberto.
Re: Downloading Historical Data
What db are you using?
Re: Downloading Historical Data
Well, I guess the .NET MySQL driver is not so good either.
I tested it by using the faster sql query and it boggled down on the .NET page.
I guess I'll try php when I get some time.
I tested it by using the faster sql query and it boggled down on the .NET page.
I guess I'll try php when I get some time.
Roberto.
Re: Downloading Historical Data
Duh... Never mind. I had limiting of fetch when I was using MySQL workbench.
If I fetch all the records, it took almost 25s for the first query and it yielded 2607 rows. It took about the same time for the second query and it yielded 106458 rows.
So, back to the MySQL server optimization.
If I fetch all the records, it took almost 25s for the first query and it yielded 2607 rows. It took about the same time for the second query and it yielded 106458 rows.
So, back to the MySQL server optimization.
Roberto.
Re: Downloading Historical Data
my portal is using php. so i have the xml sending working. i can easily create a json version of it to test out. i should be able to have this tomorrow if you guys want me to.rimai wrote:Well, I guess the .NET MySQL driver is not so good either.
I tested it by using the faster sql query and it boggled down on the .NET page.
I guess I'll try php when I get some time.
Sent from my iPad mini
Re: Downloading Historical Data
I'm not very familiar with optimizations of mysql but have you tried adding an index?
To remove index:
Code: Select all
ALTER TABLE 'tags' ADD INDEX 'name' ('name')
Code: Select all
ALTER TABLE 'tags' DROP INDEX 'name'
Last edited by phrusher on Tue Aug 05, 2014 11:01 am, edited 1 time in total.
Re: Downloading Historical Data
i think very similar to yours but im using sqlite3 and not a larger scale db. mine is just a flat file. irs pretty simplistic in terms of structure.rimai wrote:How did you structure your db?
Sent from my iPad mini
Re: Downloading Historical Data
it could even be your script to generate the data to be sent
Sent from my Moto X
Sent from my Moto X
Re: Downloading Historical Data
Yes, I already have an index for column name on table tagsphrusher wrote:I'm not very familiar with optimizations of mysql but have you tried adding an index?
To remove index:Code: Select all
ALTER TABLE 'tags' ADD INDEX 'name' ('name')
Code: Select all
ALTER TABLE 'tags' DROP INDEX 'name'
Roberto.
Re: Downloading Historical Data
Hell yeah! What did you do? All json request are now roughly 400ms
Re: Downloading Historical Data
I guess there was a setting on MySQL that was overlooked since the beginning
Roberto.
Re: Downloading Historical Data
Good thing you found it. Great work!
Re: Downloading Historical Data
that's awesome you got it figured out. better late than never.rimai wrote:I guess there was a setting on MySQL that was overlooked since the beginning