If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > Would clustering improve these lookups?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-18-09, 04:39
brendan.hill brendan.hill is offline
Registered User
 
Join Date: May 2009
Posts: 18
Would clustering improve these lookups?

Hi all, I believe I understand the principle of clustering pretty well - physically reordering the records on the disk so the related rows, likely to be relevant to the same query, are more likely to be on the same page (rather than scattered) thereby reducing page lookups from the disk for queries utilizing that index.

I typically read people saying that clustered indexes are most useful in range lookups - eg. date ranges or number ranges (eg. "where mydate between '2001/01/01' and '2001/01/03'").

Would I be correct in saying that it could help improve performance in child/parent tables as well? For example, if the parent table "invoices" had a child table "invoice_items" (with foreign key "invoice_id"), then clustering the "invoice_items" table on field "invoice_id" would increase the likelihood that all the invoice_items rows for a specific invoices row would be stored on a single page.

Sound about right?

Thanks in advance,
Brendan

Last edited by brendan.hill; 06-18-09 at 04:44.
Reply With Quote
  #2 (permalink)  
Old 07-08-09, 12:06
JayKon JayKon is offline
Registered User
 
Join Date: May 2009
Posts: 6
While you might see some improvement by clustering, it's not going to give you what you're looking for by itself. In fact, since you're pulling a single row at a time, I doubt it will do anything, except for reports.

You will get better improvement by moving one of the tables to a second physical disk.

Unfortunately, Postgres doesn't seem to support it, but something like Informix's FRAGMENT BY, or SQL Server's DPV's would give you rocking performance. Alas, maybe next year.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On