EXPLAIN ANALYZE SELECT contacts id FROM contacts LEFT OUTER JOIN SELEC

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
EXPLAIN ANALYZE
SELECT contacts.id
FROM contacts
LEFT OUTER JOIN
(SELECT DISTINCT contacts_values.company_id AS company_id,
contacts_values.id AS id
FROM contacts_values
WHERE contacts_values.field_id = '\x000000000000000000000000'
AND contacts_values.field_name = 'twitter'
AND nimble_contact_value_normalize(contacts_values.value) = nimble_contact_value_normalize('devonzuegel')
AND length(contacts_values.value) < 1024) AS anon_2
ON contacts.company_id = '\x4c2118ad54397f271b000000' AND anon_2.company_id = contacts.company_id AND anon_2.id = contacts.id
INNER JOIN
(SELECT DISTINCT contacts_values.company_id AS company_id,
contacts_values.id AS id
FROM contacts_values
WHERE contacts_values.field_id = '\x000000000000000000000000'
AND contacts_values.field_name = 'first_name'
AND nimble_contact_value_normalize(contacts_values.value) = nimble_contact_value_normalize('Devon@devonzuegel')
AND length(contacts_values.value) < 1024) AS anon_1
ON anon_1.company_id = contacts.company_id AND anon_1.id = contacts.id
LEFT OUTER JOIN contacts__aggregated AS contacts__aggregated_1
ON contacts__aggregated_1.company_id = contacts.company_id
AND contacts__aggregated_1.contact_id = contacts.id
AND contacts__aggregated_1.field_name = 'names'
AND contacts__aggregated_1.contact_id is not null
AND contacts__aggregated_1.value = nimble_contact_value_normalize('Devon')
WHERE anon_1.id IS NOT NULL OR anon_2.id IS NOT NULL
LIMIT 30
OFFSET 0