Re: [GENERAL] Planner forces seq scan when select without quoting its values

2012-09-17 Thread Alex Lai
This line from the EXPLAIN output suggests that the rule is causing a seq scan to be used instead on an index scan: ... WHERE ... a.archiveset = new.archiveset AND a.fileid <> new.fileid. When I replace the "new." with actual integers: ... WHERE ... a.archiveset = 10003 AND a.filei

Re: [GENERAL] Planner forces seq scan when select without quoting its values

2012-09-13 Thread Alex Lai
On 09/13/2012 09:59 AM, Tom Lane wrote: Alex Lai writes: "EXPLAIN insert into alex1 (fileid, archiveset) select 35352974, 10003;" [vs] "EXPLAIN insert into alex1 (fileid, archiveset) select '35352974', '10003';" You might be happier using INSERT ... VALUES instead of INSERT ... SELECT

Re: [GENERAL] Planner forces seq scan when select without quoting its values

2012-09-13 Thread Tom Lane
Alex Lai writes: >"EXPLAIN insert into alex1 (fileid, archiveset) select 35352974, 10003;" > [vs] >"EXPLAIN insert into alex1 (fileid, archiveset) select '35352974', > '10003';" You might be happier using INSERT ... VALUES instead of INSERT ... SELECT for this. In the former, the parser

[GENERAL] Planner forces seq scan when select without quoting its values

2012-09-12 Thread Alex Lai
alex1 is a table with 47 million rows and a rule that deletes from another table whenever an insert is made into alex1. Insertions into alex1 are causing a seq scan that takes a very long time: "EXPLAIN insert into alex1 (fileid, archiveset) select 35352974, 10003;" (EXPLAIN output is at