anilchahal7

All Queries For Redshift

Jan 25th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.78 KB | None | 0 0
  1. select date(ts), count(distinct(visitorid)) from apilogs where site='android' and appversion = '1.11.4' and date(ts) >='2017-01-17' group by 1 order by date(ts);
  2.  
  3.  
  4. select * from apilogs where site='android' and appversion = '1.8' and date(ts) > '2016-12-31' and action = 'AccountController-trackorderDetail' order by date(ts) limit 10;
  5.  
  6. select * from apilogs where action='AccountController-trackorderDetail' limit 10;
  7.  
  8.  
  9. select date(ts), count(distinct(visitorid)) from apilogs where site='android' and action='SearchController-search' and appversion = '1.8.1' and date(ts) >= '2017-01-01' group by 1 order by date(ts);
  10.  
  11. Select date(ts), count(distinct(visitorid)) from apilogs where action ='BoutiqueController-recentlyViewedBoutiques' and site='android' and date(ts) >= '2016-12-01' group by 1 order by date(ts);
  12.  
  13.  
  14. Select date(ts), appversion, count(distinct(visitorid)) from apilogs where site='android' and date(ts) >= '2016-12-20'
  15. and appversion in ('1.0', '1.1', '1.1.1', '1.1.2', '1.2', '1.2.1', '1.3', '1.3.1', '1.3.2', '1.4', '1.5', '1.5.1', '1.6', '1.7', '1.7.1', '1.8', '1.8.1', '') group by 1,2 order by date(ts);
  16.  
  17. select date(ts), site, count(visitorid) from apilogs where action='AccountController-trackorderDetail' and date(ts) >= '2016-12-01' and site in ('android', 'ios', 'web', 'mobile') group by 1,2 order by date(ts);
  18.  
  19.  
  20. select date(ts), count(distinct(visitorid)) from apilogs where site='android' and action='BoutiqueController-getBoutique' and appversion <= '1.8' and date(ts) >= '2016-12-31' group by 1 order by date(ts);
  21.  
  22. select date(ts), count(distinct(visitorid)) from apilogs where site='android' and date(ts) > '2016-12-20' and
  23. appversion = '1.10.2' group by 1 order by date(ts) limit 100;
  24.  
  25. select date(ts), count(distinct(visitorid)) from apilogs where site='android' and action='BoutiqueController-getCategoryPage' and appVersion='1.8.1' group by 1 order by date(ts);
  26.  
  27. select date(ts), count(distinct(visitorid)) from apilogs where site='android' and appversion='1.11.3' and date(ts) > '2016-11-27' group by 1 order by date(ts);
  28.  
  29. select * from apilogs where action='AccountController-trackorderDetail' and site='android' limit 100;
  30.  
  31. select distinct(customertype) from apilogs;
  32.  
  33. select date(ts), count(distinct(visitorid)) from apilogs where site='android' and appversion='1.10.1'and date(ts) > '2016-10-08' group by 1 order by 1;
  34.  
  35. select distinct(site) from apilogs where date(ts) = '2016-12-23';
  36.  
  37.  
  38. /* Order Return Data*/
  39. select date(ts), count(distinct(visitorid)) from apilogs where action='AccountController-orderReturn' and site = 'android' group by 1 order by date(ts);
  40.  
  41. select date(ts), count(distinct(visitorid)) from apilogs where action='AccountController-orderReturn' and date(ts) >= '2016-12-01' group by 1 order by date(ts);
  42.  
  43. Select date(ts), site, count(distinct(uri)) from apilogs where action='AccountController-trackorderDetail' and date(ts) >= '2016-12-01' and site in ('android', 'mobile', 'web', 'ios') group by 1,2 order by date(ts);
  44.  
  45. Select date(ts), appversion, count(distinct(visitorid)) from apilogs where site='android' and date(ts) >= '2016-12-20'
  46. and appversion in ('1.0', '1.1', '1.1.1', '1.1.2', '1.2', '1.2.1', '1.3', '1.3.1', '1.3.2', '1.4', '1.5', '1.5.1', '1.6', '1.7', '1.7.1', '1.8', '1.8.1', '') group by 1,2 order by date(ts);
  47.  
  48. /* Order Tracking Data*/
  49. select date(ts), count(distinct(visitorid)) from apilogs where action='AccountController-trackorderDetail' and site ='android' group by 1 order by date(ts);
  50.  
  51.  
  52.  
  53. select * from apilogs where action='ProductController-getProduct' and site='android' and date(ts) > '2016-10-28' and appversion='1.10.2' order by ts limit 10;
  54.  
  55. Select ts, elapsed from apilogs where action='ShoppingCartController-showShoppingCart' and site='android' and date(ts) > '2016-10-13' and elapsed in (Select max(elapsed) from apilogs where action='ShoppingCartController-showShoppingCart' and site='android' and date(ts) > '2016-10-13');
  56.  
  57. Select os, appversion from apilogs where date(ts) = '2016-11-30' and action='ProductController-getProduct' and site='android' and appversion='1.11' and os='android_6.0.1';
  58.  
  59. select date(ts) as Date, max(elapsed) as MaxElapsed, avg(elapsed) as AvgElapsed from apilogs where action='BoutiqueController-getSalePlan' and site='android' and date(ts) > '2016-10-28' group by 1 order by 1;
  60.  
  61. select date(ts) as Date, count(distinct visitorid) as Visitorid from apilogs where action='BoutiqueController-getSalePlan' and site='android' and date(ts) > '2016-10-28' and elapsed > 1000 group by 1 order by 1;
  62.  
  63.  
  64. select date(ts) as Date, max(elapsed) as MaxElapsed, avg(elapsed) as AvgElapsed from apilogs where action='ProductController-getProduct' and site='android' and date(ts) > '2016-10-28' group by 1 order by 1;
  65.  
  66. select date(ts) as Date, count(distinct visitorid) as Visitorid from apilogs where action='ProductController-getProduct' and site='android' and date(ts) > '2016-10-28' and elapsed > 1000 group by 1 order by 1;
  67.  
  68. /* Max min of elapsed time of Shopping Cart Response Time */
  69.  
  70. /* Max min of elapsed time of PDP Response Time */
  71. select date(ts), avg(elapsed) from apilogs where action='ProductController-getProduct' and site='android' and date(ts) > '2016-10-28' group by 1 order by 1;
  72.  
  73.  
  74. select date(ts), count(distinct(uri)) from apilogs where site='android' and action='AccountController-trackorderDetail' and date(ts) > '2016-11-29';
  75.  
  76.  
  77.  
  78. Select date(ts), case when appversion in ('1.11') then 'return' else 'old' end as app_version_category, count(distinct(visitorid)) from apilogs where site='ios' and date(ts) >= '2016-12-01'
  79. -- and appversion in ('1.0', '1.1', '1.1.1', '1.1.2', '1.2', '1.2.1', '1.3', '1.3.1', '1.3.2', '1.4', '1.5', '1.5.1', '1.6', '1.7', '1.7.1', '1.8', '1.8.1', '1.8.2', '1.9', '1.10', '1.10.1', '1.10.2', '1.11', '1.11.1', '1.11.2', '1.11.3')
  80. group by 1,2 order by date(ts);
Add Comment
Please, Sign In to add comment