Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a products table with 20,000,000+ and it's increasing. It takes alot of time to fetch a row from that table with that query select * from products where user_id = 1. So i made a partition on that table but the performance wasn't as i expected. I was thinking to use a cluster index on user_id. Any thoughts, if adding a cluster index will improve the performance or not? As adding an index on such table will be a nightmare.

share

migration rejected from stackoverflow.com May 9 '14 at 6:37

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as unclear what you're asking by Erwin Brandstetter, Phil, Max Vernon, Paul White, Mikael Eriksson May 9 '14 at 6:37

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1  
What is the meaning of a user_id in a products file ? –  wildplasser May 4 '14 at 16:00
    
The user that this product belong to, as a user has many products. –  user3601684 May 4 '14 at 16:01
3  
Postgres does not have a "cluster index". When asking advice on performance problems please see this: wiki.postgresql.org/wiki/Slow_Query_Questions –  a_horse_with_no_name May 4 '14 at 16:46
    
How do you handle the fact that the same product has multiple users? You need a separate DB table for linking users to products. –  Alexandros May 5 '14 at 5:16
    
If a user has many products, then your query does not fetch a row. –  jjanes May 5 '14 at 20:49

Browse other questions tagged or ask your own question.