By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,236 Members | 1,351 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,236 IT Pros & Developers. It's quick & easy.

determining which rows fall in which partition

P: n/a
Hi,

I have a table which is partitioned on 4nodes. I've loaded some rows
into this table. How do i view the "table data" partition-wise ?

Oct 18 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Vivek schrieb:
Hi,

I have a table which is partitioned on 4nodes. I've loaded some rows
into this table. How do i view the "table data" partition-wise ?
Vivek,

that's what you need:

select dbpartitionnum(school_id), count(*)
from students
group by dbpartitionnum(school_id);

where school_id is the partioning key.

-- Create queries for distribution of all Tables:

SELECT
'SELECT DBPARTITIONNUM(' || RTRIM(colname) ||') as PNUMBER ,
COUNT_BIG(*) as COUNTER
FROM '|| RTRIM(TABSCHEMA) ||'.'|| RTRIM(TABNAME) ||' GROUP BY
DBPARTITIONNUM(' || RTRIM(colname) ||')
ORDER BY 1@'
FROM SYSCAT.COLUMNS
WHERE PARTKEYSEQ <0;

Best regards,
Joachim Müller
Oct 18 '06 #2

P: n/a
Thanks Joachim.

Joachim Müller wrote:
Vivek schrieb:
Hi,

I have a table which is partitioned on 4nodes. I've loaded some rows
into this table. How do i view the "table data" partition-wise ?

Vivek,

that's what you need:

select dbpartitionnum(school_id), count(*)
from students
group by dbpartitionnum(school_id);

where school_id is the partioning key.

-- Create queries for distribution of all Tables:

SELECT
'SELECT DBPARTITIONNUM(' || RTRIM(colname) ||') as PNUMBER ,
COUNT_BIG(*) as COUNTER
FROM '|| RTRIM(TABSCHEMA) ||'.'|| RTRIM(TABNAME) ||' GROUP BY
DBPARTITIONNUM(' || RTRIM(colname) ||')
ORDER BY 1@'
FROM SYSCAT.COLUMNS
WHERE PARTKEYSEQ <0;

Best regards,
Joachim Müller
Oct 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.