Fixed queries.

This commit is contained in:
Michael Herzberg 2017-09-02 16:45:38 +01:00
parent f94f6140b7
commit 08fced735c
2 changed files with 20 additions and 11 deletions

View File

@ -1,4 +1,4 @@
select extension_info.downloads, extension_info.extid, extension_info.name, url
select extension_info.downloads, extension_info.extid, extension_info.name, url, crx_most_recent_and_prev.crx_etag as updated_crx
from (
-- We generate a table containing every crx_etag that we crawled within the
-- last day and is an update, and a random date where we encountered the its
@ -7,7 +7,7 @@ from (
crx_first_date1.crx_etag,
crx_first_date1.extid,
crx_first_date1.md as most_recent_update,
crx_first_date2.md as some_date_with_previous_version
max(crx_first_date2.md) as last_date_with_previous_version
from (
select crx_etag,extid,min(date) as md
from extension
@ -21,8 +21,12 @@ from (
group by crx_etag
) crx_first_date2
on crx_first_date1.extid=crx_first_date2.extid
where crx_first_date1.md>crx_first_date2.md
and DATEDIFF(CURDATE(), crx_first_date1.md) = 0
where
crx_first_date1.md>crx_first_date2.md
-- the first time we have seen the crx_etag shall be zero days in the past, rounded to days,
-- measured from the current date and hour
and
TIMESTAMPDIFF(DAY, crx_first_date1.md, TIMESTAMPADD(HOUR,HOUR(UTC_TIME),UTC_DATE)) = 0
group by crx_first_date1.crx_etag
) crx_most_recent_and_prev
inner join content_script_url
@ -42,7 +46,7 @@ and
url not in (
select url
from extension natural join content_script_url
where extid=extension_info.extid and date=some_date_with_previous_version
where extid=extension_info.extid and date=last_date_with_previous_version
)
order by extension_info.downloads desc;

View File

@ -1,4 +1,4 @@
select extension_info.downloads, extension_info.extid, extension_info.name, permission
select extension_info.downloads, extension_info.extid, extension_info.name, permission, crx_most_recent_and_prev.crx_etag as updated_crx
from (
-- We generate a table containing every crx_etag that we crawled within the
-- last day and is an update, and a random date where we encountered the its
@ -7,7 +7,7 @@ from (
crx_first_date1.crx_etag,
crx_first_date1.extid,
crx_first_date1.md as most_recent_update,
crx_first_date2.md as some_date_with_previous_version
max(crx_first_date2.md) as last_date_with_previous_version
from (
select crx_etag,extid,min(date) as md
from extension
@ -21,8 +21,12 @@ from (
group by crx_etag
) crx_first_date2
on crx_first_date1.extid=crx_first_date2.extid
where crx_first_date1.md>crx_first_date2.md
and DATEDIFF(CURDATE(), crx_first_date1.md) = 0
where
crx_first_date1.md>crx_first_date2.md
-- the first time we have seen the crx_etag shall be zero days in the past, rounded to days,
-- measured from the current date and hour
and
TIMESTAMPDIFF(DAY, crx_first_date1.md, TIMESTAMPADD(HOUR,HOUR(UTC_TIME),UTC_DATE)) = 0
group by crx_first_date1.crx_etag
) crx_most_recent_and_prev
inner join permission
@ -39,10 +43,11 @@ where
"webRequest",
"webRequestBlocking"
)
and permission not in (
and
permission not in (
select permission
from extension natural join permission
where extid=extension_info.extid and date=some_date_with_previous_version
where extid=extension_info.extid and date=last_date_with_previous_version
)
order by extension_info.downloads desc;