suneet-s commented on a change in pull request #10413:
URL: https://github.com/apache/druid/pull/10413#discussion_r493779975



##########
File path: docs/querying/sql.md
##########
@@ -1108,6 +1108,18 @@ GROUP BY 1
 ORDER BY 2 DESC
 ```
 
+If you want to retrieve segment that was compacted (ANY compaction):
+
+```sql
+SELECT * FROM sys.segments WHERE last_compaction_state is not null
+```

Review comment:
       Suggested re-write to talk about the problem an admin would be looking 
to solve more explicitly.
   
   ```suggestion
   If you want to know whether segments in the wikipedia table are not 
compacted, and therefore may be contributing to query slowness, you can run a 
query like this to tell you how many segments have not been compacted per 
interval.
   
   ```sql
   SELECT start, end, count(*) FROM sys.segments WHERE datasource = 'wikipedia' 
and last_compaction_state is not null group by 1, 2
   ```
   
   If you find that queries that hit these intervals are slow - consider 
enabling [compaction](../operations/segment-optimization.md) to produce more 
optimal segments.
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to