MySQL Forums :: Newbie :: count rows in a partition


Advanced Search

count rows in a partition
Posted by: Darren White ()
Date: May 14, 2013 10:46PM

I have innodb and version 5.6

I have some tables partitioned by month like this:
ALTER TABLE pgs.log_01
PARTITION BY LIST ( month( time ) )
(
PARTITION p0 VALUES IN ( 0 ),
PARTITION p1 VALUES IN ( 1 ),
PARTITION p2 VALUES IN ( 2 ),
PARTITION p3 VALUES IN ( 3 ),
PARTITION p4 VALUES IN ( 4 ),
PARTITION p5 VALUES IN ( 5 ),
PARTITION p6 VALUES IN ( 6 ),
PARTITION p7 VALUES IN ( 7 ),
PARTITION p8 VALUES IN ( 8 ),
PARTITION p9 VALUES IN ( 9 ),
PARTITION p10 VALUES IN ( 10),
PARTITION p11 VALUES IN ( 11 ),
PARTITION p12 VALUES IN ( 12 )
);

How can I do a COUNT(*) on a particular parition?

What I want to do is this:

SELECT COUNT(*) FROM log_01 WHERE PARTITION=1

Options: ReplyQuote


Subject Written By Posted
count rows in a partition Darren White 05/14/2013 10:46PM
Re: count rows in a partition John Smith 05/15/2013 12:52AM
Re: count rows in a partition Rick James 05/15/2013 08:16PM
Re: count rows in a partition Darren White 05/15/2013 09:54PM
Re: count rows in a partition Rick James 05/16/2013 08:35AM
Re: count rows in a partition Darren White 07/30/2013 08:47AM
Re: count rows in a partition Rick James 07/30/2013 08:54PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.