> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8c05c8a2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# quantilesTimingIf

> مثال على استخدام المُركِّب quantilesTimingIf

<div id="description">
  ## الوصف
</div>

يمكن تطبيق المُركِّب [`If`](/ar/reference/functions/aggregate-functions/combinators#-if) على الدالة [`quantilesTiming`](/ar/reference/functions/aggregate-functions/quantileTiming)
لحساب القيم المئينية لقيم التوقيت للصفوف التي يكون فيها الشرط صحيحًا،
باستخدام دالة المُركِّب التجميعي `quantilesTimingIf`.

<div id="example-usage">
  ## مثال على الاستخدام
</div>

في هذا المثال، سننشئ جدولًا يخزّن أزمنة استجابة واجهة برمجة التطبيقات لنقاط نهاية مختلفة،
وسنستخدم `quantilesTimingIf` لحساب مئينات زمن الاستجابة للطلبات الناجحة.

```sql title="Query" theme={null}
CREATE TABLE api_responses(
    endpoint String,
    response_time_ms UInt32,
    is_successful UInt8
) ENGINE = MergeTree
ORDER BY ();

INSERT INTO api_responses VALUES
    ('orders', 82, 1),
    ('orders', 94, 1),
    ('orders', 98, 1),
    ('orders', 87, 1),
    ('orders', 103, 1),
    ('orders', 92, 1),
    ('orders', 89, 1),
    ('orders', 105, 1),
    ('products', 45, 1),
    ('products', 52, 1),
    ('products', 48, 1),
    ('products', 51, 1),
    ('products', 49, 1),
    ('products', 53, 1),
    ('products', 47, 1),
    ('products', 50, 1),
    ('users', 120, 0),
    ('users', 125, 0),
    ('users', 118, 0),
    ('users', 122, 0),
    ('users', 121, 0),
    ('users', 119, 0),
    ('users', 123, 0),
    ('users', 124, 0);

SELECT
    endpoint,
    quantilesTimingIf(0, 0.25, 0.5, 0.75, 0.95, 0.99, 1.0)(response_time_ms, is_successful = 1) as response_time_quantiles
FROM api_responses
GROUP BY endpoint;
```

ستحسب الدالة `quantilesTimingIf` القيم المئينية للطلبات الناجحة فقط (is\_successful = 1).
تحتوي المصفوفة المُعادة على القيم المئينية التالية بالترتيب:

* 0 (الحد الأدنى)
* 0.25 (الربع الأول)
* 0.5 (الوسيط)
* 0.75 (الربع الثالث)
* 0.95 (المئين 95)
* 0.99 (المئين 99)
* 1.0 (الحد الأقصى)

```response title="Response" theme={null}
   ┌─endpoint─┬─response_time_quantiles─────────────────────────────────────────────┐
1. │ orders   │ [82, 87, 92, 98, 103, 104, 105]                                     │
2. │ products │ [45, 47, 49, 51, 52, 52, 53]                                        │
3. │ users    │ [nan, nan, nan, nan, nan, nan, nan]                                 │
   └──────────┴─────────────────────────────────────────────────────────────────────┘
```

<div id="see-also">
  ## انظر أيضًا
</div>

* [`quantilesTiming`](/ar/reference/functions/aggregate-functions/quantileTiming)
* [`If مُركِّب`](/ar/reference/functions/aggregate-functions/combinators#-if)
