Re: Auto-tuning a VIEW?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




create view v1 (code,num) as
select 'AAA',id from table1
union
select 'BBB',id from table2;

As your rows are, by definition, distinct between each subquery, you should use UNION ALL instead of UNION to save postgres the trouble of hunting non-existing duplicates. This will save you a few sorts.

select * from v1 where code||num = 'AAA2005000001';

	Why don't you use code='AAA' and num='2005000001' ?


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux