Unix Technical Forum

to partition or not to partition that is the question

This is a discussion on to partition or not to partition that is the question within the pgsql Hackers forums, part of the PostgreSQL category; --> I have two types of tables, for sake of argument lets call it these: 1) product 10,000,000 rows 2) ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 09:10 AM
Timasmith
 
Posts: n/a
Default to partition or not to partition that is the question

I have two types of tables, for sake of argument lets call it these:

1) product 10,000,000 rows
2) product_activity 1,000,000,000 rows

90% of the type the product table is accessed by product_id, 80% of
the time that product id would be in the last 1,000,000 rows of the
table i.e. a recent product id.

90% of the time the product_activity table is accessed by product_id +
a date range - often the last 24 hours.

One option seems to be not to use partitions at all and have a
product_history table and a product_activity_history table. The work
falls on the application to use UNION queries to extract data when
needed across both tables, implement a criteria for moving the records
into the history table and dealing with the issues of related tables
referencing product ids that are in other tables.

Alternatively I could partition the two tables by date range. I am
not sure how effective that would be for product but I guess I could
hit that table first and if it hits, great - performance saved, and if
it doesnt oh well get it from the history table.

Certainly product_activity seems like a good partitioning contender.
Of course maintaining monthly partitions is a lot of work but I guess
you could create them in advance for several years.

Is partitioning the way to go in this case?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 09:10 AM
Josh Berkus
 
Posts: n/a
Default Re: to partition or not to partition that is the question

Tim,

> I have two types of tables, for sake of argument lets call it these:
>
> 1) product * * * * * * * * *10,000,000 rows
> 2) product_activity *1,000,000,000 rows


pgsql-performance is the correct list for your question. Please re-post it
there. -hackers is for PostgreSQL development.

--
Josh Berkus
PostgreSQL @ Sun
San Francisco

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-12-2008, 09:12 AM
Timasmith
 
Posts: n/a
Default Re: to partition or not to partition that is the question

On Jun 19, 2:23 pm, j...@agliodbs.com (Josh Berkus) wrote:
> Tim,
>
> > I have two types of tables, for sake of argument lets call it these:

>
> > 1) product 10,000,000 rows
> > 2) product_activity 1,000,000,000 rows

>
> pgsql-performance is the correct list for your question. Please re-post it
> there. -hackers is for PostgreSQL development.
>
> --
> Josh Berkus
> PostgreSQL @ Sun
> San Francisco
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster


Well no reply in pgsql-performance so it was pointless re-post, I
posted here because there is more activity in this forum.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:51 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com