[PERFORM] Seq scan on big table, episode 2

2012-10-31 Thread Vincenzo Melandri
Hi all :) I'm here again. This time I'll provide more details (explain analyze, data-type, and indexes), hope it will be enough :) The query that is performing a plan that i do not understand is the following: select [some fields from all 3 tables] from DATA_SEQUENCES join

Re: [PERFORM] Seq scan on big table, episode 2

2012-10-31 Thread Vincenzo Melandri
I may (or may not) have found the solution: a reindex on the 3 tables fixed the query plan. Now I can plan to reindex only the involved indexes at the start of the data import procedure. On Wed, Oct 31, 2012 at 11:55 AM, Vincenzo Melandri vmelan...@imolinfo.itwrote: Hi all :) I'm here again

[PERFORM] Seq scan on 10million record table.. why?

2012-10-30 Thread Vincenzo Melandri
Hi all I have a problem with a data import procedure that involve the following query: select a,b,c,d from big_table b join data_sequences_table ds on b.key1 = ds.key1 and b.key2 = ds.key2 where ds.import_id=xx The big table has something like 10.000.000 records ore more (depending on

Re: [PERFORM] Seq scan on 10million record table.. why?

2012-10-30 Thread Vincenzo Melandri
1) Make all types the same 2) If you are using some narrow type for big_table (say, int2) to save space, you can force narrowing conversion, e.g. b.key1=ds.key1::int2. Note that if ds.key1 has any values that don't fit into int2, you will have problems. And of course, use your type used