Re: [HACKERS] Interesting speed anomaly

2005-12-15 Thread Jim C. Nasby
On Thu, Dec 15, 2005 at 12:04:33AM +0100, Zoltan Boszormenyi wrote: The VIEW is created like this (shorter example): create view v1 (code,num) as select 'AAA',id from table1 union select 'BBB',id from table2; I created the indexes on the individual tables as create index index1 on

Re: [HACKERS] Interesting speed anomaly

2005-12-15 Thread Zoltan Boszormenyi
Jim C. Nasby írta: Those queries aren't the same though. The view is equivalent to SELECT * FROM (select 'AAA' AS prefix,id from table 1 union select 'AAA',id from table 2 ) view WHERE prefix||id = '...' In this case the prefixes have already been unioned together, so there's no

[HACKERS] Interesting speed anomaly

2005-12-14 Thread Zoltan Boszormenyi
Hi, I am trying to prove whether PostgreSQL is faster than Informix so I can feed the management with numbers. In our system, there is an invoice browser view, an UNION of 12 different tables. (Yes, there are 12 different invoices, like new or second-hand cars, warranty, service, etc, with

Re: [HACKERS] Interesting speed anomaly

2005-12-14 Thread Tom Lane
Zoltan Boszormenyi [EMAIL PROTECTED] writes: $ time echo select * from v_invoice_browse where code||inv_no = 'CARO20020' | dbaccess db Is there a way to speed this operation up? Make an expression index on code||inv_no, if you think this case is important enough to be worth maintaining

Re: [HACKERS] Interesting speed anomaly

2005-12-14 Thread Zoltan Boszormenyi
Tom Lane írta: Zoltan Boszormenyi [EMAIL PROTECTED] writes: $ time echo select * from v_invoice_browse where code||inv_no = 'CARO20020' | dbaccess db Is there a way to speed this operation up? Make an expression index on code||inv_no, if you think this case is

Re: [HACKERS] Interesting speed anomaly

2005-12-14 Thread Gavin Sherry
On Wed, 14 Dec 2005, Zoltan Boszormenyi wrote: Tom Lane írta: Zoltan Boszormenyi [EMAIL PROTECTED] writes: $ time echo select * from v_invoice_browse where code||inv_no = 'CARO20020' | dbaccess db Is there a way to speed this operation up? Make an expression index

Re: [HACKERS] Interesting speed anomaly

2005-12-14 Thread Gavin Sherry
On Thu, 15 Dec 2005, Gavin Sherry wrote: On Wed, 14 Dec 2005, Zoltan Boszormenyi wrote: Tom Lane írta: Zoltan Boszormenyi [EMAIL PROTECTED] writes: $ time echo select * from v_invoice_browse where code||inv_no = 'CARO20020' | dbaccess db Is there a way to

Re: [HACKERS] Interesting speed anomaly

2005-12-14 Thread Zoltan Boszormenyi
Gavin Sherry írta: On Thu, 15 Dec 2005, Gavin Sherry wrote: On Wed, 14 Dec 2005, Zoltan Boszormenyi wrote: Tom Lane írta: Zoltan Boszormenyi [EMAIL PROTECTED] writes: $ time echo select * from v_invoice_browse where code||inv_no = 'CARO20020' | dbaccess db