Index Scan
using idx_orders_status_customer_id_trip_accepted_time_deleted_at_v1 on orders
(cost=0.57..144.02
rows=162
width=8)
(actual
time=0.018..8.726
rows=5,279
loops=1)
Index Cond: ((status = 4) AND (customer_id = 1,768,288) AND (deleted_at IS NULL))
Planning time
:
0.272 ms
Execution time
:
9.150ms
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Aggregate (cost=144.43..144.44 rows=1 width=8) (actual time=9.128..9.129 rows=1 loops=1)
-> Index Scan using idx_orders_status_customer_id_trip_accepted_time_deleted_at_v1 on orders (cost=0.57..144.02 rows=162 width=8) (actual time=0.018..8.726 rows=5279 loops=1)
Index Cond: ((status = 4) AND (customer_id = 1768288) AND (deleted_at IS NULL))
Planning Time: 0.272 ms
Execution Time: 9.150 ms
(5 rows)
EXPLAIN ANALYZE
SELECT
sum(
orders.customer_fare_without_previous_due
) AS sum_id
FROM
orders
WHERE
orders.deleted_at IS NULL AND
orders.customer_id = '1768288' AND
orders.status = 4;
EXPLAIN ANALYZE
SELECT
sum(
orders.customer_fare_without_previous_due
) AS sum_id
FROM
orders
WHERE
orders.deleted_at IS NULL AND
orders.customer_id = '1768288' AND
orders.status = 4;
-- Formatted by Pg::SQL::PrettyPrinter
\d index_orders_customer_id_with_completed_status_and_not_deleted
Index "public.index_orders_customer_id_with_completed_status_and_not_deleted"
Column | Type | Key? | Definition
-------------+---------+------+-------------
customer_id | integer | yes | customer_id
btree, for table "public.orders", predicate (status = 4 AND deleted_at IS NULL)
\di+ index_orders_customer_id_with_completed_status_and_not_deleted
List of relations
Schema | Name | Type | Owner | Table | Persistence | Access method | Size | Description
--------+----------------------------------------------------------------+-------+----------+--------+-------------+---------------+---------+-------------
public | index_orders_customer_id_with_completed_status_and_not_deleted | index | postgres | orders | permanent | btree | 1708 MB |
(1 row)
\idx_orders_status_customer_id_trip_accepted_time_deleted_at_v1v1
Index "public.idx_orders_status_customer_id_trip_accepted_time_deleted_at_v1"
Column | Type | Key? | Definition
--------------------+-----------------------------+------+--------------------
status | integer | yes | status
customer_id | integer | yes | customer_id
trip_accepted_time | integer | yes | trip_accepted_time
deleted_at | timestamp without time zone | yes | deleted_at
btree, for table "public.orders"
Schema | Name | Type | Owner | Table | Persistence | Access method | Size | Description
--------+----------------------------------------------------------------+-------+----------+--------+-------------+---------------+---------+-------------
public | idx_orders_status_customer_id_trip_accepted_time_deleted_at_v1 | index | postgres | orders | permanent | btree | 5688 MB |
(1 row)
ANALYZE Activity
Autovac. Analyze Threshold 50 Autovac. Analyze Scale Factor 5%
TYPE
STARTED BY
TIME FINISHED
ANALYZE
User
May 07 01:45:52am IST · a day ago