Is it possible to group rows together that have geometries that overlap? If so, is it also possible to make that a configurable threshold. Let's say I have a table representing data that looks like:

Let's say I'd like to get the number of geometries in each overlapping cluster together with the bounding box of the cluster. I'd like to do something like:
SELECT
ST_Extent(geom) as bbox,
COUNT(*) as count
FROM table
GROUP BY ???
The result that I would hope for is:
|bbox |count|
|---------|-----|
|bbox(B,C)| 2 |
|bbox(D,E)| 2 |
|bbox(A) | 1 |
As a bonus question, I'd also like to be able to parameterize this over an overlap threshold like Jaccard index. Meaning I'd like to get the same sort of grouping if the geometries overlap sufficiently. For example, I'd like to get the same grouping as previously mentioned but split up D and E if the don't overlap by the supplied threshold:
|bbox |count|
|---------|-----|
|bbox(B,C)| 2 |
|bbox(D) | 1 |
|bbox(E) | 1 |
|bbox(A) | 1 |
AoverlappedB? Would you expect A, B, and C to be a single group? Or are you just looking for pairs? – dbaston Feb 21 '18 at 22:10A,B, andCto be a single group. – Matt Feb 22 '18 at 14:07