QUERY PLAN
Limit (cost=149.40..149.41 rows=2 width=20)
-> Sort (cost=149.40..149.41 rows=2 width=20)
Sort Key: s.created_at DESC
-> Subquery Scan on s (cost=149.34..149.39 rows=2 width=20)
-> GroupAggregate (cost=149.34..149.37 rows=2 width=20)
Group Key: "*SELECT* 1".title
-> Sort (cost=149.34..149.34 rows=2 width=20)
Sort Key: "*SELECT* 1".title
-> Append (cost=103.04..149.33 rows=2 width=20)
-> Subquery Scan on "*SELECT* 1" (cost=103.04..103.07 rows=1 width=21)
-> GroupAggregate (cost=103.04..103.06 rows=1 width=34)
Group Key: pip.title
-> Sort (cost=103.04..103.04 rows=1 width=21)
Sort Key: pip.title
-> Nested Loop Left Join (cost=0.28..103.03 rows=1 width=21)
-> Seq Scan on tbl_purchase_invoice_products pip (cost=0.00..94.72 rows=1 width=17)
Filter: ((title)::text ~~* '%的%'::text)
-> Index Scan using tbl_purchase_contract_invoices_pkey on tbl_purchase_contract_invoices pci (cost=0.28..8.30 rows=1 width=12)
Index Cond: (id = pip.purchase_invoice_id)
-> Subquery Scan on "*SELECT* 2" (cost=46.23..46.26 rows=1 width=20)
-> GroupAggregate (cost=46.23..46.25 rows=1 width=32)
Group Key: pip_1.title
-> Sort (cost=46.23..46.23 rows=1 width=20)
Sort Key: pip_1.title
-> Nested Loop Left Join (cost=0.28..46.22 rows=1 width=20)
-> Seq Scan on tbl_sales_invoice_products pip_1 (cost=0.00..37.91 rows=1 width=16)
Filter: ((title)::text ~~* '%的%'::text)
-> Index Scan using tbl_sales_contract_invoices_pkey on tbl_sales_contract_invoices pci_1 (cost=0.28..8.30 rows=1 width=12)
Index Cond: (id = pip_1.sales_invoice_id)