Hi Jakub, Thank you very much for your reply.
To get any info logged to bh.err, I had to set ‘ControlMessages = 2’ in the brighthouse.ini file… is this correct?
I did that, and here’s what I get..
1. First query, with dimension table joins
select sum(f.ifintotaloctets) AS "In" , sum(f.ifouttotaloctets) AS "Out"
from fact f, dim_config d, dim_time t
where t.timestamp_key between 1227762000 and 1227769140
and d.ifpid = 300021
and f.ifpid = d.ifpid
and f.timestamp_key = t.timestamp_key ;
bh.err:
2008-12-17 08:56:24 [3] T:-1 = TABLE_ALIAS(T:0)
T:-2 = TMP_TABLE(T:-1)
T:-3 = TABLE_ALIAS(T:1)
T:-2.JOIN(T:-3)
T:-4 = TABLE_ALIAS(T:2)
T:-2.JOIN(T:-4)
F:0 = CREATE_FILTER(T:-2,TERM(t:-4 a:0),BETWEEN,TERM(vn:1227762000),TERM(vn:1227769140),WHERE)
F:0 = AND(F:0,TERM(t:-3 a:0),=,TERM(vn:300021),TERM(<null>))
F:0 = AND(F:0,TERM(t:-1 a:0),=,TERM(vn:300021),TERM(<null>))
F:0 = AND(F:0,TERM(t:-4 a:0),=,TERM(t:-1 a:1),TERM(<null>))
T:-2.FILTER(F:0)
A:-1 = T:-2.ADD_COLUMN(TERM(t:-1 a:11),SUM,"ifintotaloctets","ALL")
A:-2 = T:-2.ADD_COLUMN(TERM(t:-1 a:12),SUM,"ifouttotaloctets","ALL")
RESULT(T:-2)
2008-12-17 08:56:24 [3] Initial execution plan:
2008-12-17 08:56:24 [3] Cnd(0): t:-3 a:0 BET. vn:300021 AND vn:300021 (0)
2008-12-17 08:56:24 [3] Cnd(1): t:-1 a:0 BET. vn:300021 AND vn:300021 (0)
2008-12-17 08:56:24 [3] Cnd(2): t:-4 a:0 BET. vn:1227762000 AND vn:1227769140 (4.78)
2008-12-17 08:56:24 [3] Cnd(3): t:-4 a:0 = t:-1 a:1 (38.78)
2008-12-17 08:56:24 [3] Packs/packrows after KN evaluation:
2008-12-17 08:56:24 [3] (t0) Pckrows: 2705, susp. 2705 (0 empty 0 full). Packs opened in 1 cond.: 2705
2008-12-17 08:56:24 [3] (t1) Pckrows: 2, susp. 1 (1 empty 0 full). Packs opened in 1 cond.: 1
2008-12-17 08:56:24 [3] (t2) Pckrows: 1, susp. 1 (0 empty 0 full). Packs opened in 1 cond.: 1
2008-12-17 08:56:24 [3] (t0-t2) Pack2Pack pairs: 100% possible.
2008-12-17 08:57:00 [3] Packrows after exact evaluation (WHERE):
2008-12-17 08:57:00 [3] (t0): 2705 all packrows, 1805 to open (including 0 full)
2008-12-17 08:57:00 [3] (t1): 2 all packrows, 1 to open (including 0 full)
2008-12-17 08:57:00 [3] (t2): 1 all packrows, 1 to open (including 0 full)
2008-12-17 08:57:00 [3] Traversed all 120 rows.
2008-12-17 08:57:03 [3] Produced 120 tuples.
2008-12-17 08:57:03 [3] Tuples after inner join 2-0 [hash]: 120
2008-12-17 08:57:03 [3] Displaying result: 1 rows.
2008-12-17 08:57:03 [3] Total data packs actually loaded (approx.): 3430
2008-12-17 08:57:03 [3] ----------------------------------------------------------------------------
NOTE: It seemed to take even longer this morning.. almost 40 seconds.. maybe it had to reload cache?
2. Second query (with no joins)
select sum(fact5.ifintotaloctets) AS "BytesInShown" , sum(fact5.ifouttotaloctets) AS "BytesOutShown"
from fact fact5
where fact5.timestamp_key between 1227762000 and 1227769140
and fact5.ifpid = 300021 ;
bh.err
2008-12-17 09:00:27 [4] T:-1 = TABLE_ALIAS(T:0)
T:-2 = TMP_TABLE(T:-1)
F:0 = CREATE_FILTER(T:-2,TERM(t:-1 a:1),BETWEEN,TERM(vn:1227762000),TERM(vn:1227769140),WHERE)
F:0 = AND(F:0,TERM(t:-1 a:0),=,TERM(vn:300021),TERM(<null>))
T:-2.FILTER(F:0)
A:-1 = T:-2.ADD_COLUMN(TERM(t:-1 a:11),SUM,"ifintotaloctets","ALL")
A:-2 = T:-2.ADD_COLUMN(TERM(t:-1 a:12),SUM,"ifouttotaloctets","ALL")
RESULT(T:-2)
2008-12-17 09:00:27 [4] Initial execution plan:
2008-12-17 09:00:27 [4] Cnd(0): t:-1 a:0 BET. vn:300021 AND vn:300021 (0)
2008-12-17 09:00:27 [4] Cnd(1): t:-1 a:1 BET. vn:1227762000 AND vn:1227769140 (16.27)
2008-12-17 09:00:27 [4] Packs/packrows after KN evaluation:
2008-12-17 09:00:27 [4] (t0) Pckrows: 2705, susp. 180 (2525 empty 0 full). Packs opened in 2 cond.: 181
2008-12-17 09:00:28 [4] Packrows after exact evaluation (WHERE):
2008-12-17 09:00:28 [4] (t0): 2705 all packrows, 120 to open (including 0 full)
2008-12-17 09:00:28 [4] Displaying result: 1 rows.
2008-12-17 09:00:28 [4] Total data packs actually loaded (approx.): 0
2008-12-17 09:00:28 [4] ----------------------------------------------------------------------------
Very fast.. < 1 sec
Since the first query had taken much longer than it had yesterday (~40sec compared to ~6sec) I ran it again..
2008-12-17 09:01:29 [5] Initial execution plan:
2008-12-17 09:01:29 [5] Cnd(0): t:-3 a:0 BET. vn:300021 AND vn:300021 (0)
2008-12-17 09:01:29 [5] Cnd(1): t:-1 a:0 BET. vn:300021 AND vn:300021 (0)
2008-12-17 09:01:29 [5] Cnd(2): t:-4 a:0 BET. vn:1227762000 AND vn:1227769140 (4.78)
2008-12-17 09:01:29 [5] Cnd(3): t:-4 a:0 = t:-1 a:1 (38.78)
2008-12-17 09:01:29 [5] Packs/packrows after KN evaluation:
2008-12-17 09:01:29 [5] (t0) Pckrows: 2705, susp. 2705 (0 empty 0 full). Packs opened in 1 cond.: 2705
2008-12-17 09:01:29 [5] (t1) Pckrows: 2, susp. 1 (1 empty 0 full). Packs opened in 1 cond.: 1
2008-12-17 09:01:29 [5] (t2) Pckrows: 1, susp. 1 (0 empty 0 full). Packs opened in 1 cond.: 1
2008-12-17 09:01:29 [5] (t0-t2) Pack2Pack pairs: 100% possible.
2008-12-17 09:01:35 [5] Packrows after exact evaluation (WHERE):
2008-12-17 09:01:35 [5] (t0): 2705 all packrows, 1805 to open (including 0 full)
2008-12-17 09:01:35 [5] (t1): 2 all packrows, 1 to open (including 0 full)
2008-12-17 09:01:35 [5] (t2): 1 all packrows, 1 to open (including 0 full)
2008-12-17 09:01:35 [5] Traversed all 120 rows.
2008-12-17 09:01:35 [5] Produced 120 tuples.
2008-12-17 09:01:35 [5] Tuples after inner join 2-0 [hash]: 120
2008-12-17 09:01:35 [5] Displaying result: 1 rows.
2008-12-17 09:01:35 [5] Total data packs actually loaded (approx.): 0
2008-12-17 09:01:35 [5] ----------------------------------------------------------------------------
Back to around 6 seconds, presumably working from memory cache.
Does this provide clues for speeding up the join?
Cheers, Bob