---
title: Queries
framework: healthkit
role: collectionGroup
role_heading: API Collection
path: healthkit/queries
---

# Queries

Query health and fitness data.

## Overview

Overview Use queries to read sample data from the HealthKit store. You can also use queries to list all the sources for a particular data type, or to perform statistical calculations for a data type. For example, statistical queries can calculate the minimum and maximum heart rate for a given week, or the total step count for a given day. You run a query by calling the HealthKit store’s execute(_:) method. HealthKit returns a snapshot of the current results to the query’s results handler. Long-running queries continue to monitor the HealthKit store, and return any relevant changes to the query’s update handler. To return sorted or filtered results, give the query a sort descriptor or predicate.

## Topics

### Essentials

- [Reading data from HealthKit](healthkit/reading-data-from-healthkit.md)

### Swift concurrency support

- [Running Queries with Swift Concurrency](healthkit/running-queries-with-swift-concurrency.md)
- [HKAsyncQuery](healthkit/hkasyncquery.md)
- [HKAsyncSequenceQuery](healthkit/hkasyncsequencequery.md)
- [HKSamplePredicate](healthkit/hksamplepredicate.md)

### Basic queries

- [HKSampleQueryDescriptor](healthkit/hksamplequerydescriptor.md)
- [HKSampleQuery](healthkit/hksamplequery.md)
- [HKCorrelationQuery](healthkit/hkcorrelationquery.md)
- [HKQueryDescriptor](healthkit/hkquerydescriptor.md)
- [HKQuery](healthkit/hkquery.md)

### Series queries

- [HKQuantitySeriesSampleQueryDescriptor](healthkit/hkquantityseriessamplequerydescriptor.md)
- [HKQuantitySeriesSampleQuery](healthkit/hkquantityseriessamplequery.md)
- [HKWorkoutRouteQueryDescriptor](healthkit/hkworkoutroutequerydescriptor.md)
- [HKWorkoutRouteQuery](healthkit/hkworkoutroutequery.md)
- [HKHeartbeatSeriesQueryDescriptor](healthkit/hkheartbeatseriesquerydescriptor.md)
- [HKHeartbeatSeriesQuery](healthkit/hkheartbeatseriesquery.md)
- [HKElectrocardiogramQueryDescriptor](healthkit/hkelectrocardiogramquerydescriptor.md)
- [HKElectrocardiogramQuery](healthkit/hkelectrocardiogramquery.md)
- [HKWorkoutEffortRelationship](healthkit/hkworkouteffortrelationship.md)
- [HKWorkoutEffortRelationshipQuery](healthkit/hkworkouteffortrelationshipquery.md)

### Long-running queries

- [HKActivitySummaryQueryDescriptor](healthkit/hkactivitysummaryquerydescriptor.md)
- [HKActivitySummaryQuery](healthkit/hkactivitysummaryquery.md)
- [HKAnchoredObjectQueryDescriptor](healthkit/hkanchoredobjectquerydescriptor.md)
- [HKAnchoredObjectQuery](healthkit/hkanchoredobjectquery.md)
- [HKObserverQuery](healthkit/hkobserverquery.md)

### Sources and devices

- [HKSourceQueryDescriptor](healthkit/hksourcequerydescriptor.md)
- [HKSourceRevision](healthkit/hksourcerevision.md)
- [HKSource](healthkit/hksource.md)
- [HKDevice](healthkit/hkdevice.md)
- [HKSourceQuery](healthkit/hksourcequery.md)

### Statistics

- [Executing Statistical Queries](healthkit/executing-statistical-queries.md)
- [Executing Statistics Collection Queries](healthkit/executing-statistics-collection-queries.md)
- [HKStatisticsQueryDescriptor](healthkit/hkstatisticsquerydescriptor.md)
- [HKStatisticsQuery](healthkit/hkstatisticsquery.md)
- [HKStatisticsCollectionQueryDescriptor](healthkit/hkstatisticscollectionquerydescriptor.md)
- [HKStatisticsCollectionQuery](healthkit/hkstatisticscollectionquery.md)
- [HKStatistics](healthkit/hkstatistics.md)
- [HKStatisticsCollection](healthkit/hkstatisticscollection.md)
- [HKStatisticsOptions](healthkit/hkstatisticsoptions.md)

### Clinical record queries

- [HKVerifiableClinicalRecordQueryDescriptor](healthkit/hkverifiableclinicalrecordquerydescriptor.md)
- [HKVerifiableClinicalRecordQuery](healthkit/hkverifiableclinicalrecordquery.md)
- [HKVerifiableClinicalRecordSourceType](healthkit/hkverifiableclinicalrecordsourcetype.md)
- [HKVerifiableClinicalRecordCredentialType](healthkit/hkverifiableclinicalrecordcredentialtype.md)
- [HKDocumentQuery](healthkit/hkdocumentquery.md)

### Medication queries

- [HKClinicalCoding](healthkit/hkclinicalcoding.md)
- [HKHealthConceptIdentifier](healthkit/hkhealthconceptidentifier.md)
- [HKMedicationConcept](healthkit/hkmedicationconcept.md)
- [HKMedicationDoseEvent](healthkit/hkmedicationdoseevent.md)
- [HKMedicationDoseEventType](healthkit/hkmedicationdoseeventtype.md)
- [HKUserAnnotatedMedication](healthkit/hkuserannotatedmedication.md)
- [HKUserAnnotatedMedicationQuery](healthkit/hkuserannotatedmedicationquery.md)
- [HKUserAnnotatedMedicationType](healthkit/hkuserannotatedmedicationtype.md)
- [HKHealthConceptDomain](healthkit/hkhealthconceptdomain.md)
- [HKMedicationGeneralForm](healthkit/hkmedicationgeneralform.md)
- [HKUserAnnotatedMedicationQueryDescriptor](healthkit/hkuserannotatedmedicationquerydescriptor.md)

## See Also

### Health data

- [Saving data to HealthKit](healthkit/saving-data-to-healthkit.md)
- [Reading data from HealthKit](healthkit/reading-data-from-healthkit.md)
- [HKHealthStore](healthkit/hkhealthstore.md)
- [Creating a Mobility Health App](healthkit/creating-a-mobility-health-app.md)
- [Data types](healthkit/data-types.md)
- [Samples](healthkit/samples.md)
- [Visualizing HealthKit State of Mind in visionOS](healthkit/visualizing-healthkit-state-of-mind-in-visionos.md)
- [Logging symptoms associated with a medication](healthkit/logging-symptoms-associated-with-a-medication.md)
