# How many text files are not served with gzip?

**URL:** <https://discuss.httparchive.org/t/how-many-text-files-are-not-served-with-gzip/1092>\
**Category:** Analysis\
**Created:** [October 9, 2017, 4:46pm UTC](https://discuss.httparchive.org/t/how-many-text-files-are-not-served-with-gzip/1092 "2017-10-09T16:46:29Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![paulcalvano](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/paulcalvano/32/1601_2.png) [@paulcalvano](https://discuss.httparchive.org/u/paulcalvano)\
**Post date:** [October 12, 2017, 12:46am UTC](https://discuss.httparchive.org/t/how-many-text-files-are-not-served-with-gzip/1092/8 "2017-10-12T00:46:49Z")

</div>

I would update that query to also include requests where `type="xml"`. The values of the type column also did not contain `js` or `json`, since they were represented with `type="script"`.

Here’s a query that looks at all of the type values, and summarizes the percentage of uncompressed content:

```sql
SELECT type,
       COUNT(*) total,
       SUM(IF(resp_content_encoding!="gzip" AND resp_content_encoding!="deflate" AND resp_content_encoding!="brotli",1,0)) uncompresed_text,
       ROUND(SUM(IF(resp_content_encoding!="gzip" AND resp_content_encoding!="deflate" AND resp_content_encoding!="brotli",1,0)) / COUNT(*),2) percent_uncompressed
FROM httparchive.runs.2017_09_15_requests  
GROUP BY type
ORDER BY total DESC

```

When looking at the results for this, you can see the `type` values that are textual are script, html, css, xml and text. You can see that 27% of script resources are uncompressed, along with 61% of html, 28% of css, 47% of xml, etc

![image](https://canada1.discourse-cdn.com/flex035/uploads/httparchive/original/1X/62a85dcd7911b376eb67d3ed2bc05c1629f24c14.png)

If we combine the textual content and look at the overall percentage of uncompressed text resources - we get approximately 36% of text based content is not being compressed.

```sql
SELECT SUM(IF(type="script" OR type="html" OR type="css" OR type="xml" OR type="text",1,0)) text,
       SUM(IF(type="script" OR type="html" OR type="css" OR type="xml" OR type="text",IF(resp_content_encoding!="gzip" AND resp_content_encoding!="deflate" AND resp_content_encoding!="brotli",1,0),0)) uncompresed_text,
       ROUND(SUM(IF(type="script" OR type="html" OR type="css" OR type="xml" OR type="text",IF(resp_content_encoding!="gzip" AND resp_content_encoding!="deflate" AND resp_content_encoding!="brotli",1,0),0)) /SUM(IF(type="script" OR type="html" OR type="css" OR type="xml" OR type="text",1,0)),2) UncompressedText
FROM httparchive.runs.2017_09_15_requests

```

![image](https://canada1.discourse-cdn.com/flex035/uploads/httparchive/original/1X/d8ef6800ad83b3a5668f66fb06b816f3ca053822.png)

Michael Gooding and Gareth Hughes did a Fluent presentation (June 2017) where they looked at similar data for gzip and brotli compression per domain to understand not just the percentage of resources that were compressed overall, but also look at histograms of resources compressed per url. The slides for that are here - [https://www.slideshare.net/GarethHughes3/tldr-web-performance-workshop](https://www.slideshare.net/GarethHughes3/tldr-web-performance-workshop) (slides 35 and 37 have content related to this)

---

_[View the full topic](https://discuss.httparchive.org/t/how-many-text-files-are-not-served-with-gzip/1092)._
