Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id C075D2E3456 for ; Tue, 11 Dec 2007 14:19:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60178-01-3 for ; Tue, 11 Dec 2007 14:18:57 -0400 (AST) Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by postgresql.org (Postfix) with ESMTP id 8EBC32E3460 for ; Tue, 11 Dec 2007 14:18:57 -0400 (AST) Received: from [192.168.2.102] ([71.100.89.137]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JSW00AUWDILOHV5@vms046.mailsrvcs.net> for pgsql-sql@postgresql.org; Tue, 11 Dec 2007 12:18:22 -0600 (CST) Date: Tue, 11 Dec 2007 13:18:17 -0500 From: Gerry Reno Subject: Re: join on three tables is slow In-reply-to: <162867790712110655o2cf99bf1n9acf6b440d726440@mail.gmail.com> To: pgsql-sql@postgresql.org Message-id: <475ED469.5080906@verizon.net> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: quoted-printable References: <475C96EA.6090002@verizon.net> <475CC478.7010102@Sheeky.Biz> <475E111B.6060203@verizon.net> <162867790712102200m2144573bw7447e0eff6720d55@mail.gmail.com> <475E8F6A.4030004@verizon.net> <162867790712110655o2cf99bf1n9acf6b440d726440@mail.gmail.com> User-Agent: Thunderbird 1.5.0.12 (X11/20070530) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/50 X-Sequence-Number: 29742 Pavel Stehule wrote: > Hello > > there is diference in agg position. Send, please, query and explain > analyze output. And test id =3D any (... ) looks like hard > denormalisation and can do problems. This condition can be slow and > for large arrays is better use multivalues. > > SELECT * > FROM tab > WHERE x IN (VALUES(10),(20)); > > it's faster when sizeof(array) > 80 > > Regards > Pavel Stehule > > > > =20 WITH e.active =3D true =3D# EXPLAIN ANALYZE select p.addr, p.name, p.name2 from myfile as p join= =20 res_partner as e on e.id in ( 3214, 3213, 3212, 3211, 3210, 3209, 3208,=20 3207, 3206, 3205, 3204, 3203, 3202, 3201, 3200, 3199, 3198, 3197, 3196,=20 3195, 3194, 3193, 3192, 3191, 3190, 3189, 3188, 3187, 3186, 3185, 3184,=20 3183, 3176, 3175, 3174, 3173, 3172, 3171, 3170, 3169, 3168, 3167, 3166,=20 3165, 3164, 3163, 3162, 3161, 3160, 3159, 3158, 3157, 3156, 3155, 3154,=20 3153, 3152, 3151, 3150, 3149, 3148, 3147, 3146, 3145, 3144, 3143, 3142,=20 3141, 3140, 3139, 3138, 3137, 3136, 3135, 3134, 3133, 3132, 3131, 3130,=20 3129, 3128, 3127, 3126, 3125, 3124, 3123, 3122, 3121, 3120, 3119, 3118,=20 3117, 3116, 3115, 3114, 3113, 3112, 3111, 3110, 3109, 3108, 3107, 3106,=20 3105, 3104, 3103, 3102, 3101, 3100, 3099, 3098, 3097, 3096, 3095, 3094,=20 3093, 3092, 3091, 3090, 3089, 3088, 3087, 3086, 3085, 3084, 3083, 3082,=20 3081, 3080, 3079, 3078, 3077, 3076, 3075, 3074, 3073, 3072, 3071, 3070,=20 3069, 3068, 3067, 3066, 3065, 3064, 3063, 3062, 3061, 3060, 3059, 3058,=20 3057, 3056, 3055, 3054, 3053, 3052, 3051, 3050, 3049, 3048, 3047, 3046,=20 3045, 3044, 3043, 3042, 3041, 3040, 3039, 3038, 3037, 3036, 3035, 3034,=20 3033, 3032, 3031, 3030, 3029, 3028, 3027, 3026, 3025, 3024, 3023, 3022,=20 3021, 3020, 3019, 3018, 3017, 3016, 3015, 3014, 3013, 3012, 3011, 3010,=20 3009, 3008, 3007, 3006, 3005, 3004, 3003, 3002, 3001, 3000, 2999, 2998,=20 2997, 2996, 2995, 2994, 2993, 2992, 2991, 2990, 2989, 2988, 2987, 2986,=20 2985, 2984, 2983, 2982, 2981, 2980, 2979, 2978, 2977, 2976, 2975, 2974,=20 2973, 2972, 2971, 2970, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962,=20 2961, 2960, 2959, 2958, 2957, 2956, 2955, 2954, 2953, 2952, 2951, 2950,=20 2949, 2948, 2947, 2946, 2945, 2944, 2943, 2942, 2941, 2940, 2939, 2938,=20 2937, 2936, 2935, 2934, 2933, 2932, 2931, 2930, 2929, 2928, 2927, 2926,=20 2925, 2924, 2923, 2922, 2921, 2920, 2919, 2918, 2917, 2916, 2915, 2914,=20 2913, 2912, 2911, 2910, 2909, 2908, 2907, 2906, 2905, 2904, 2903, 2902,=20 2901, 2900, 2899, 2898, 2897, 2896, 2895, 2894, 2893, 2892, 2891, 2890,=20 2889, 2888, 2887, 2886, 2885, 2884, 2883, 2882, 2881, 2880, 2879, 2878,=20 2877, 2876, 2875, 2874, 2873, 2872, 2871, 2870, 2869, 2868, 2867, 2866,=20 2865, 2864, 2863, 2862, 2861, 2860, 2859, 2858, 2857, 2856, 2855, 2854,=20 2853, 2852, 2851, 2850, 2849, 2848, 2847, 2846, 2845, 2844, 2843, 2842,=20 2841, 2840, 2839, 2838, 2837, 2836, 2835, 2834, 2833, 2832, 2831, 2830,=20 2829, 2828, 2827, 2826, 2825, 2824, 2823, 2822, 2821, 2820, 2819, 2818,=20 2817, 2816, 2815, 2814, 2813, 2812, 2811, 2810, 2809, 2808, 2807, 2806,=20 2805, 2804, 2803, 2802, 2801, 2800, 2799, 2798, 2797, 2796, 2795, 2794,=20 2793, 2792, 2791, 2790, 2789, 2788, 2787, 2786, 2785, 2784, 2783, 2782,=20 2781, 2780, 2779, 2778, 2777, 2776, 2775, 2774, 2773, 2772, 2771, 2770,=20 2769, 2768, 2767, 2766, 2765, 2764, 2763, 2762, 2761, 2760, 2759, 2758,=20 2757, 2756, 2755, 2754, 2753, 2752, 2751, 2750, 2749, 2748, 2747, 2746,=20 2745, 2744, 2743, 2742, 2741, 2740, 2739, 2738, 2737, 2736, 2735, 2734,=20 2733, 2732, 2731, 2730, 2729, 2728, 2727, 2726, 2725, 2724, 2723, 2722,=20 2721, 2720, 2719, 2718, 2717, 2716, 2715, 2714, 2713, 2712, 2711, 2710,=20 2709, 2708, 2707, 2706, 2705, 2704, 2703, 2702, 2701, 2700, 2699, 2698,=20 3182, 3181, 3180, 3179, 3178, 3177, 50, 49, 48, 47, 22, 25 ) and p.addr=20 =3D e.addr join res_partner_address as a on a.partner_id =3D e.id and=20 (a.type =3D 'default' or a.type IS NULL) and (p.name !=3D a.name or p.nam= e2=20 !=3D a.name2) and p.addr =3D e.addr where p.date =3D e.date and e.date =3D= =20 (select max(date) from res_partner as msd where msd.addr =3D p.addr) and = e.active =3D true; = = = = = = = = = = = = = = = = = = =20 QUERY=20 PLAN = = = = = = = = = = = = = = = = = = =20 -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= --------------------------------------- Nested Loop (cost=3D0.00..4044.83 rows=3D1 width=3D726) (actual=20 time=3D512002.518..513103.896 rows=3D1 loops=3D1) Join Filter: (((p.addr)::text =3D (e.addr)::text) AND (p.date =3D e.da= te)=20 AND (((p.name)::text <> (a.name)::text) OR ((p.name2)::text <>=20 (a.name2)::text))) -> Nested Loop (cost=3D0.00..199.35 rows=3D1 width=3D730) (actual=20 time=3D2.468..59.751 rows=3D520 loops=3D1) -> Seq Scan on res_partner_address a (cost=3D0.00..88.40=20 rows=3D16 width=3D552) (actual time=3D0.851..16.131 rows=3D559 loops=3D1)= Filter: ((("type")::text =3D 'default'::text) OR ("type" I= S=20 NULL)) -> Index Scan using res_partner_id_uniq on res_partner e =20 (cost=3D0.00..6.92 rows=3D1 width=3D186) (actual time=3D0.048..0.059 rows= =3D1=20 loops=3D559) Index Cond: (a.partner_id =3D e.id) Filter: ((id =3D ANY=20 ('{3214,3213,3212,3211,3210,3209,3208,3207,3206,3205,3204,3203,3202,3201,= 3200,3199,3198,3197,3196,3195,3194,3193,3192,3191,3190,3189,3188,3187,318= 6,3185,3184,3183,3176,3175,3174,3173,3172,3171,3170,3169,3168,3167,3166,3= 165,3164,3163,3162,3161,3160,3159,3158,3157,3156,3155,3154,3153,3152,3151= ,3150,3149,3148,3147,3146,3145,3144,3143,3142,3141,3140,3139,3138,3137,31= 36,3135,3134,3133,3132,3131,3130,3129,3128,3127,3126,3125,3124,3123,3122,= 3121,3120,3119,3118,3117,3116,3115,3114,3113,3112,3111,3110,3109,3108,310= 7,3106,3105,3104,3103,3102,3101,3100,3099,3098,3097,3096,3095,3094,3093,3= 092,3091,3090,3089,3088,3087,3086,3085,3084,3083,3082,3081,3080,3079,3078= ,3077,3076,3075,3074,3073,3072,3071,3070,3069,3068,3067,3066,3065,3064,30= 63,3062,3061,3060,3059,3058,3057,3056,3055,3054,3053,3052,3051,3050,3049,= 3048,3047,3046,3045,3044,3043,3042,3041,3040,3039,3038,3037,3036,3035,303= 4,3033,3032,3031,3030,3029,3028,3027,3026,3025,3024,3023,3022,3021,3020,3= 019,3018,3017,3016,3015,3014,3013,3012,3011,3010,3009,3008,3007,3006,3005= ,3004,3003,3002,3001,3000,2999,2998,2997,2996,2995,2994,2993,2992,2991,29= 90,2989,2988,2987,2986,2985,2984,2983,2982,2981,2980,2979,2978,2977,2976,= 2975,2974,2973,2972,2971,2970,2969,2968,2967,2966,2965,2964,2963,2962,296= 1,2960,2959,2958,2957,2956,2955,2954,2953,2952,2951,2950,2949,2948,2947,2= 946,2945,2944,2943,2942,2941,2940,2939,2938,2937,2936,2935,2934,2933,2932= ,2931,2930,2929,2928,2927,2926,2925,2924,2923,2922,2921,2920,2919,2918,29= 17,2916,2915,2914,2913,2912,2911,2910,2909,2908,2907,2906,2905,2904,2903,= 2902,2901,2900,2899,2898,2897,2896,2895,2894,2893,2892,2891,2890,2889,288= 8,2887,2886,2885,2884,2883,2882,2881,2880,2879,2878,2877,2876,2875,2874,2= 873,2872,2871,2870,2869,2868,2867,2866,2865,2864,2863,2862,2861,2860,2859= ,2858,2857,2856,2855,2854,2853,2852,2851,2850,2849,2848,2847,2846,2845,28= 44,2843,2842,2841,2840,2839,2838,2837,2836,2835,2834,2833,2832,2831,2830,= 2829,2828,2827,2826,2825,2824,2823,2822,2821,2820,2819,2818,2817,2816,281= 5,2814,2813,2812,2811,2810,2809,2808,2807,2806,2805,2804,2803,2802,2801,2= 800,2799,2798,2797,2796,2795,2794,2793,2792,2791,2790,2789,2788,2787,2786= ,2785,2784,2783,2782,2781,2780,2779,2778,2777,2776,2775,2774,2773,2772,27= 71,2770,2769,2768,2767,2766,2765,2764,2763,2762,2761,2760,2759,2758,2757,= 2756,2755,2754,2753,2752,2751,2750,2749,2748,2747,2746,2745,2744,2743,274= 2,2741,2740,2739,2738,2737,2736,2735,2734,2733,2732,2731,2730,2729,2728,2= 727,2726,2725,2724,2723,2722,2721,2720,2719,2718,2717,2716,2715,2714,2713= ,2712,2711,2710,2709,2708,2707,2706,2705,2704,2703,2702,2701,2700,2699,26= 98,3182,3181,3180,3179,3178,3177,50,49,48,47,22,25}'::integer[]))=20 AND active) -> Seq Scan on myfile p (cost=3D0.00..3845.46 rows=3D1 width=3D730) = (actual time=3D1.971..983.174 rows=3D510 loops=3D520) Filter: ((subplan) =3D date) SubPlan -> Aggregate (cost=3D159.20..159.22 rows=3D1 width=3D4) (act= ual=20 time=3D1.867..1.871 rows=3D1 loops=3D268840) -> Seq Scan on res_partner msd (cost=3D0.00..159.16=20 rows=3D16 width=3D4) (actual time=3D1.331..1.821 rows=3D1 loops=3D268840)= Filter: ((addr)::text =3D ($0)::text) Total runtime: 513105.731 ms (15 rows) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D WITHOUT e.active =3D true =3D# EXPLAIN ANALYZE select p.addr, p.name, p.name2 from myfile as p join= =20 res_partner as e on e.id in ( 3214, 3213, 3212, 3211, 3210, 3209, 3208,=20 3207, 3206, 3205, 3204, 3203, 3202, 3201, 3200, 3199, 3198, 3197, 3196,=20 3195, 3194, 3193, 3192, 3191, 3190, 3189, 3188, 3187, 3186, 3185, 3184,=20 3183, 3176, 3175, 3174, 3173, 3172, 3171, 3170, 3169, 3168, 3167, 3166,=20 3165, 3164, 3163, 3162, 3161, 3160, 3159, 3158, 3157, 3156, 3155, 3154,=20 3153, 3152, 3151, 3150, 3149, 3148, 3147, 3146, 3145, 3144, 3143, 3142,=20 3141, 3140, 3139, 3138, 3137, 3136, 3135, 3134, 3133, 3132, 3131, 3130,=20 3129, 3128, 3127, 3126, 3125, 3124, 3123, 3122, 3121, 3120, 3119, 3118,=20 3117, 3116, 3115, 3114, 3113, 3112, 3111, 3110, 3109, 3108, 3107, 3106,=20 3105, 3104, 3103, 3102, 3101, 3100, 3099, 3098, 3097, 3096, 3095, 3094,=20 3093, 3092, 3091, 3090, 3089, 3088, 3087, 3086, 3085, 3084, 3083, 3082,=20 3081, 3080, 3079, 3078, 3077, 3076, 3075, 3074, 3073, 3072, 3071, 3070,=20 3069, 3068, 3067, 3066, 3065, 3064, 3063, 3062, 3061, 3060, 3059, 3058,=20 3057, 3056, 3055, 3054, 3053, 3052, 3051, 3050, 3049, 3048, 3047, 3046,=20 3045, 3044, 3043, 3042, 3041, 3040, 3039, 3038, 3037, 3036, 3035, 3034,=20 3033, 3032, 3031, 3030, 3029, 3028, 3027, 3026, 3025, 3024, 3023, 3022,=20 3021, 3020, 3019, 3018, 3017, 3016, 3015, 3014, 3013, 3012, 3011, 3010,=20 3009, 3008, 3007, 3006, 3005, 3004, 3003, 3002, 3001, 3000, 2999, 2998,=20 2997, 2996, 2995, 2994, 2993, 2992, 2991, 2990, 2989, 2988, 2987, 2986,=20 2985, 2984, 2983, 2982, 2981, 2980, 2979, 2978, 2977, 2976, 2975, 2974,=20 2973, 2972, 2971, 2970, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962,=20 2961, 2960, 2959, 2958, 2957, 2956, 2955, 2954, 2953, 2952, 2951, 2950,=20 2949, 2948, 2947, 2946, 2945, 2944, 2943, 2942, 2941, 2940, 2939, 2938,=20 2937, 2936, 2935, 2934, 2933, 2932, 2931, 2930, 2929, 2928, 2927, 2926,=20 2925, 2924, 2923, 2922, 2921, 2920, 2919, 2918, 2917, 2916, 2915, 2914,=20 2913, 2912, 2911, 2910, 2909, 2908, 2907, 2906, 2905, 2904, 2903, 2902,=20 2901, 2900, 2899, 2898, 2897, 2896, 2895, 2894, 2893, 2892, 2891, 2890,=20 2889, 2888, 2887, 2886, 2885, 2884, 2883, 2882, 2881, 2880, 2879, 2878,=20 2877, 2876, 2875, 2874, 2873, 2872, 2871, 2870, 2869, 2868, 2867, 2866,=20 2865, 2864, 2863, 2862, 2861, 2860, 2859, 2858, 2857, 2856, 2855, 2854,=20 2853, 2852, 2851, 2850, 2849, 2848, 2847, 2846, 2845, 2844, 2843, 2842,=20 2841, 2840, 2839, 2838, 2837, 2836, 2835, 2834, 2833, 2832, 2831, 2830,=20 2829, 2828, 2827, 2826, 2825, 2824, 2823, 2822, 2821, 2820, 2819, 2818,=20 2817, 2816, 2815, 2814, 2813, 2812, 2811, 2810, 2809, 2808, 2807, 2806,=20 2805, 2804, 2803, 2802, 2801, 2800, 2799, 2798, 2797, 2796, 2795, 2794,=20 2793, 2792, 2791, 2790, 2789, 2788, 2787, 2786, 2785, 2784, 2783, 2782,=20 2781, 2780, 2779, 2778, 2777, 2776, 2775, 2774, 2773, 2772, 2771, 2770,=20 2769, 2768, 2767, 2766, 2765, 2764, 2763, 2762, 2761, 2760, 2759, 2758,=20 2757, 2756, 2755, 2754, 2753, 2752, 2751, 2750, 2749, 2748, 2747, 2746,=20 2745, 2744, 2743, 2742, 2741, 2740, 2739, 2738, 2737, 2736, 2735, 2734,=20 2733, 2732, 2731, 2730, 2729, 2728, 2727, 2726, 2725, 2724, 2723, 2722,=20 2721, 2720, 2719, 2718, 2717, 2716, 2715, 2714, 2713, 2712, 2711, 2710,=20 2709, 2708, 2707, 2706, 2705, 2704, 2703, 2702, 2701, 2700, 2699, 2698,=20 3182, 3181, 3180, 3179, 3178, 3177, 50, 49, 48, 47, 22, 25 ) and p.addr=20 =3D e.addr join res_partner_address as a on a.partner_id =3D e.id and=20 (a.type =3D 'default' or a.type IS NULL) and (p.name !=3D a.name or p.nam= e2=20 !=3D a.name2) and p.addr =3D e.addr where p.date =3D e.date and e.date =3D= =20 (select max(date) from res_partner as msd where msd.addr =3D p.addr); = = = = = = = = = = = = = = = = = = =20 QUERY=20 PLAN = = = = = = = = = = = = = = = = = = =20 -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------------------------------------------------------= -------------------------- Nested Loop (cost=3D0.00..4044.85 rows=3D1 width=3D726) (actual=20 time=3D11786.432..13216.290 rows=3D1 loops=3D1) Join Filter: (((p.addr)::text =3D (e.addr)::text) AND (p.date =3D e.da= te)=20 AND (((p.name)::text <> (a.name)::text) OR ((p.name2)::text <>=20 (a.name2)::text))) -> Seq Scan on myfile p (cost=3D0.00..3845.46 rows=3D1 width=3D730) = (actual time=3D2.347..993.933 rows=3D510 loops=3D1) Filter: ((subplan) =3D date) SubPlan -> Aggregate (cost=3D159.20..159.22 rows=3D1 width=3D4) (act= ual=20 time=3D1.884..1.886 rows=3D1 loops=3D517) -> Seq Scan on res_partner msd (cost=3D0.00..159.16=20 rows=3D16 width=3D4) (actual time=3D1.337..1.838 rows=3D1 loops=3D517) Filter: ((addr)::text =3D ($0)::text) -> Nested Loop (cost=3D0.00..199.35 rows=3D2 width=3D730) (actual=20 time=3D1.357..22.270 rows=3D522 loops=3D510) -> Seq Scan on res_partner_address a (cost=3D0.00..88.40=20 rows=3D16 width=3D552) (actual time=3D0.106..3.521 rows=3D559 loops=3D510= ) Filter: ((("type")::text =3D 'default'::text) OR ("type" I= S=20 NULL)) -> Index Scan using res_partner_id_uniq on res_partner e =20 (cost=3D0.00..6.92 rows=3D1 width=3D186) (actual time=3D0.017..0.021 rows= =3D1=20 loops=3D285090) Index Cond: (a.partner_id =3D e.id) Filter: (id =3D ANY=20 ('{3214,3213,3212,3211,3210,3209,3208,3207,3206,3205,3204,3203,3202,3201,= 3200,3199,3198,3197,3196,3195,3194,3193,3192,3191,3190,3189,3188,3187,318= 6,3185,3184,3183,3176,3175,3174,3173,3172,3171,3170,3169,3168,3167,3166,3= 165,3164,3163,3162,3161,3160,3159,3158,3157,3156,3155,3154,3153,3152,3151= ,3150,3149,3148,3147,3146,3145,3144,3143,3142,3141,3140,3139,3138,3137,31= 36,3135,3134,3133,3132,3131,3130,3129,3128,3127,3126,3125,3124,3123,3122,= 3121,3120,3119,3118,3117,3116,3115,3114,3113,3112,3111,3110,3109,3108,310= 7,3106,3105,3104,3103,3102,3101,3100,3099,3098,3097,3096,3095,3094,3093,3= 092,3091,3090,3089,3088,3087,3086,3085,3084,3083,3082,3081,3080,3079,3078= ,3077,3076,3075,3074,3073,3072,3071,3070,3069,3068,3067,3066,3065,3064,30= 63,3062,3061,3060,3059,3058,3057,3056,3055,3054,3053,3052,3051,3050,3049,= 3048,3047,3046,3045,3044,3043,3042,3041,3040,3039,3038,3037,3036,3035,303= 4,3033,3032,3031,3030,3029,3028,3027,3026,3025,3024,3023,3022,3021,3020,3= 019,3018,3017,3016,3015,3014,3013,3012,3011,3010,3009,3008,3007,3006,3005= ,3004,3003,3002,3001,3000,2999,2998,2997,2996,2995,2994,2993,2992,2991,29= 90,2989,2988,2987,2986,2985,2984,2983,2982,2981,2980,2979,2978,2977,2976,= 2975,2974,2973,2972,2971,2970,2969,2968,2967,2966,2965,2964,2963,2962,296= 1,2960,2959,2958,2957,2956,2955,2954,2953,2952,2951,2950,2949,2948,2947,2= 946,2945,2944,2943,2942,2941,2940,2939,2938,2937,2936,2935,2934,2933,2932= ,2931,2930,2929,2928,2927,2926,2925,2924,2923,2922,2921,2920,2919,2918,29= 17,2916,2915,2914,2913,2912,2911,2910,2909,2908,2907,2906,2905,2904,2903,= 2902,2901,2900,2899,2898,2897,2896,2895,2894,2893,2892,2891,2890,2889,288= 8,2887,2886,2885,2884,2883,2882,2881,2880,2879,2878,2877,2876,2875,2874,2= 873,2872,2871,2870,2869,2868,2867,2866,2865,2864,2863,2862,2861,2860,2859= ,2858,2857,2856,2855,2854,2853,2852,2851,2850,2849,2848,2847,2846,2845,28= 44,2843,2842,2841,2840,2839,2838,2837,2836,2835,2834,2833,2832,2831,2830,= 2829,2828,2827,2826,2825,2824,2823,2822,2821,2820,2819,2818,2817,2816,281= 5,2814,2813,2812,2811,2810,2809,2808,2807,2806,2805,2804,2803,2802,2801,2= 800,2799,2798,2797,2796,2795,2794,2793,2792,2791,2790,2789,2788,2787,2786= ,2785,2784,2783,2782,2781,2780,2779,2778,2777,2776,2775,2774,2773,2772,27= 71,2770,2769,2768,2767,2766,2765,2764,2763,2762,2761,2760,2759,2758,2757,= 2756,2755,2754,2753,2752,2751,2750,2749,2748,2747,2746,2745,2744,2743,274= 2,2741,2740,2739,2738,2737,2736,2735,2734,2733,2732,2731,2730,2729,2728,2= 727,2726,2725,2724,2723,2722,2721,2720,2719,2718,2717,2716,2715,2714,2713= ,2712,2711,2710,2709,2708,2707,2706,2705,2704,2703,2702,2701,2700,2699,26= 98,3182,3181,3180,3179,3178,3177,50,49,48,47,22,25}'::integer[])) Total runtime: 13217.118 ms (15 rows)