# How many text-based resources are served without compression?

**URL:** <https://discuss.httparchive.org/t/how-many-text-based-resources-are-served-without-compression/136>\
**Category:** Analysis\
**Created:** [November 22, 2013, 10:26pm UTC](https://discuss.httparchive.org/t/how-many-text-based-resources-are-served-without-compression/136 "2013-11-22T22:26:34Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![igrigorik](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/igrigorik/32/925_2.png) [@igrigorik](https://discuss.httparchive.org/u/igrigorik)\
**Post date:** [November 22, 2013, 10:26pm UTC](https://discuss.httparchive.org/t/how-many-text-based-resources-are-served-without-compression/136/1 "2013-11-22T22:26:36Z")

</div>

```sql
SELECT type, compressed, resource_count, megabytes, type_ratio,
  ROUND(total_ratio*100) as total_ratio
FROM (
  SELECT type, compressed, resource_count, megabytes,
    ROUND(type_ratio*100) as type_ratio,
    RATIO_TO_REPORT(resource_count) OVER () as total_ratio
  FROM (
    SELECT type, compressed,
      ROUND(SUM(respSize/(1024*1024))) as megabytes,
      COUNT(*) as resource_count,
      RATIO_TO_REPORT(resource_count) OVER (PARTITION BY type) as type_ratio
    FROM (
      SELECT respSize,
        REGEXP_EXTRACT(LOWER(resp_content_type),r'(script|json|html|css|xml|plain)') as type,
        IF (REGEXP_MATCH(LOWER(resp_content_encoding), r'gzip|deflate'), INTEGER(1), INTEGER(0)) AS compressed,
      FROM [httparchive:runs.latest_requests]
    )
    WHERE type IS NOT NULL
    GROUP BY type, compressed
  )
) ORDER BY type, compressed DESC

```

![](https://yyz1.discourse-cdn.com/flex035/uploads/httparchive/85/5fc0d674265122bc.png)

_Note: some responses (~4%) don’t provide a content-type while they claim to apply gzip/deflate to the response… these are excluded from above calculation._

- 47% of HTML resources are served without gzip or deflate
- 36% of CSS resources are served without gzip or deflate
- 26% of JS resources are served without gzip or deflate

In total, ~37% of resources are served as uncompressed.

---

_[View the full topic](https://discuss.httparchive.org/t/how-many-text-based-resources-are-served-without-compression/136)._
