Re: [PERFORM] FWD: Update touches unrelated indexes?

2006-06-29 Thread Tom Lane
Josh Berkus forwards: > I hope someone can explain what I'm seeing on our system. I've got a > table with about four million rows in it (see schema below). Almost > every column has one or two indexes. What I've found is that when I > issue an update statement to zero out the content of a particul

[PERFORM] FWD: Update touches unrelated indexes?

2006-06-29 Thread Josh Berkus
Folks, Jozsef is having trouble posting to the list, but he's receiving messages fine. So reply to the list and not to me. Message follows: Original Message --- The original post: Title: Update touches unrelated indexes!? Hi Everyone, I hope someone can explain what I'm seei

Re: [PERFORM] Sort order in sub-select

2006-06-29 Thread Tom Lane
"Craig A. James" <[EMAIL PROTECTED]> writes: > insert into hitlist(p_id, sortorder) > (select p_id, nextval('hitlist_seq') from >(select p_id, min(data) as m from c group by p_id order by m); > Apparently, the sort order returned by the innermost select is NOT > maintained as you go

Re: [PERFORM] explain analyze reports 20x more time than actual

2006-06-29 Thread Tom Lane
"Craig A. James" <[EMAIL PROTECTED]> writes: > I have a query that needs to run faster, with the obvious solution > being to add an index. But to confirm this, I ran explain analyze. > When I run the actual query, it consistently takes 6-7 seconds by the > wall clock. My application with a "verbo

[PERFORM] Sort order in sub-select

2006-06-29 Thread Craig A. James
Here is a question about SQL. I have a one-to-many pair of tables (call them "P" and "C" for parent and child). For each row of P, there are many rows in C with data, and I want to sort P on the min(c.data). The basic query is simple: select p_id, min(data) as m from c group by p_id order b

[PERFORM] explain analyze reports 20x more time than actual

2006-06-29 Thread Craig A. James
I have a query that needs to run faster, with the obvious solution being to add an index. But to confirm this, I ran explain analyze. When I run the actual query, it consistently takes 6-7 seconds by the wall clock. My application with a "verbose" mode enabled reports 6.6 seconds consistentl