explain.depesz.com

PostgreSQL's explain analyze made readable

Result: BMhZ

Settings
# exclusive inclusive rows x rows loops node
1. 5.050 334.038 ↓ 0.0 2,120 1

| -> Sort row IDs: roster_shifts.starts_at (cost=2153.25 rows=59631) (cost=0..0 rows=0 width=0) (actual time=329.910..334.038 rows=2,120 loops=1)

2. 117.516 328.988 ↓ 0.0 2,120 1

Filter: ((roster_shifts.roster_id in (2,3,4,5,17,18,19,20,21,22,23,24,25)) and (roster_shifts.user_id is not null) and (roster_shifts.starts_at < TIMESTAMP'2020-10-31 00:00:00') and (from_unixtime((ceiling((unix_timestamp(roster_shifts.ends_at) / 90)) * 90)) > '2020-10-15 23:00:00') and (roster_shifts.user_id in (325,34,28,53,259,186,145,400,401,106,201,21,200,58,143,198,62,451,402,248,461,187,224,403,42,320,404,20,43,19,80,405,142,241,18,120,252,68,141,406,226,140,273,407,257,61,468,464,153,74,93,16,243,94,421,472,470,438,78,441,183,432,85,408,251,409,460,440,193,229,237,452,311,75,434,410,137,465,450,82,474,133,462,31,442,65,433,131,9,95,204,431,96,13,55,97,245,411,136,255,459,528,426,412,25,454,458,135,265,254,194,330,413,463,414,419,478,22,479,429,81,121,83,26,443,123,422,70,457,233,234,79,98,415,196,341,64,208,209,149,130,99,195,210,246,424,101,473,124,36,84,134,175,214,212,256,125,11,297,102,103,445,448,446,180,253,475,213,148,456,222,24,27,60,263,104,466,147,217,476,425,35,89,261,33,444,56,417,427,447,430,218,418,420,428,439,189,467,15,118))) (cost=0..0 rows=0 width=0) (actual time=248.240..328.988 rows=2,120 loops=1)

3. 211.472 211.472 ↓ 0.0 116,872 1

Index lookup on roster_shifts using index_roster_shifts_on_tenant_id (tenant_id=2) (cost=0..0 rows=0 width=0) (actual time=0.072..211.472 rows=116,872 loops=1)