Re: [PERFORM] Very slow query (3-4mn) on a table with 25millions rows

2016-07-28 Thread Abadie Lana
7 84 02 Get the latest ITER news on http://www.iter.org/whatsnew From: Félix GERZAGUET [mailto:felix.gerzag...@gmail.com] Sent: 27 July 2016 11:37 To: Abadie Lana Cc: Martín Marqués; Tom Lane; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Very slow query (3-4mn) on a table with 25millions

Re: [PERFORM] Very slow query (3-4mn) on a table with 25millions rows

2016-07-27 Thread Abadie Lana
runtime: 40007.716 ms Lana From: Félix GERZAGUET [mailto:felix.gerzag...@gmail.com] Sent: 27 July 2016 11:16 To: Abadie Lana Cc: Martín Marqués; Tom Lane; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Very slow query (3-4mn) on a table with 25millions rows Hello Lana, On Wed, Jul

Re: [PERFORM] Very slow query (3-4mn) on a table with 25millions rows

2016-07-27 Thread Félix GERZAGUET
On Wed, Jul 27, 2016 at 11:15 AM, Félix GERZAGUET wrote: > I don't know how to give the planner more accurate info ... > Could you try to materialize the e.name subquery in another table. As in create table func_var_name_for_tpl_15 as select e.name

Re: [PERFORM] Very slow query (3-4mn) on a table with 25millions rows

2016-07-27 Thread Félix GERZAGUET
Hello Lana, On Wed, Jul 27, 2016 at 8:03 AM, Abadie Lana wrote: > Here the result of explain (analyse, buffer). Thanks for your help and let > me know if you need more information. I noticed 3 things in your query: 1. In the second part (after the except), the 2 tables utva and utv are not jo

Re: [PERFORM] Very slow query (3-4mn) on a table with 25millions rows

2016-07-26 Thread Abadie Lana
0 Buffers: shared hit=785 Total runtime: 75622.559 ms (104 rows) Lana ABADIE Database Engineer CODAC Section ITER Organization, Building 72/4108, SCOD, Control System Division Route de Vinon-sur-Verdon - CS 90 046 - 13067 St Paul Lez Durance Cedex - France Ph

Re: [PERFORM] Very slow query (3-4mn) on a table with 25millions rows

2016-07-26 Thread Martín Marqués
El 26/07/16 a las 06:01, Abadie Lana escribió: > Hi Tom, > Thanks for the hints.. > > I made various tests for index > The best I could get is the following one with > create index vat_funcvaratt_multi_idx on > functionalvarattributes(split_part(split_part(attvalue,' ',1),'.',1), tag_id, > attt

Re: [PERFORM] Very slow query (3-4mn) on a table with 25millions rows

2016-07-26 Thread Abadie Lana
-> Index Only Scan using usertemplvarattribute_atttypeid_key on usertemplvarattribute utva (cost=0.4 2..4.60 rows=9 width=8) (actual time=0.002..0.004 rows=10 loops=256) Index Cond: (usertempvariable_fk = utv.id)

Re: [PERFORM] Very slow query (3-4mn) on a table with 25millions rows

2016-07-25 Thread Tom Lane
Abadie Lana writes: > I'm having a problem with a slow query - I tried several things to optimize > the queries but didn't really help. The output of explain analyse shows > sequential scan on a table of 25 million rows. Even though it is indexed and > (I put a multi-column index on the fields

[PERFORM] Very slow query (3-4mn) on a table with 25millions rows

2016-07-25 Thread Abadie Lana
Hi all I'm having a problem with a slow query - I tried several things to optimize the queries but didn't really help. The output of explain analyse shows sequential scan on a table of 25 million rows. Even though it is indexed and (I put a multi-column index on the fields used in the query), th