Created
May 1, 2011 21:02
-
-
Save umitanuki/950872 to your computer and use it in GitHub Desktop.
Join fix issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table size_m as select i as id, repeat(i::text, i % 100) as val from generate_series(1, 20000) i; | |
create table size_l as select i as id, m.id as m_id, repeat(i::text, i % 100) as val from generate_series(1, 1000000) i, size_m m where i.i / 10 = m.id; | |
--create index idx_m_id on size_l (m_id); | |
analyze size_m; | |
analyze size_l; | |
---- | |
select m_id, sum_len from size_m m inner join(select m_id, sum(length(val)) as sum_len from size_l group by m_id)l on m.id = l.m_id where val = '10101'; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment