[PERFORM] PostgreSQL using the wrong Index

2005-06-13 Thread Alex Stapleton
We have two index's like so l1_historical=# \d N_intra_time_idx Index N_intra_time_idx Column |Type +- time | timestamp without time zone btree l1_historical=# \d N_intra_pkey Index N_intra_pkey Column |Type

Re: [PERFORM] PostgreSQL using the wrong Index

2005-06-13 Thread Alex Stapleton
Oh, we are running 7.4.2 btw. And our random_page_cost = 1 On 13 Jun 2005, at 14:02, Alex Stapleton wrote: We have two index's like so l1_historical=# \d N_intra_time_idx Index N_intra_time_idx Column |Type +- time | timestamp without

Re: [PERFORM] PostgreSQL using the wrong Index

2005-06-13 Thread Tom Lane
Alex Stapleton [EMAIL PROTECTED] writes: l1_historical=# \d N_intra_pkey Index N_intra_pkey Column |Type +- symbol | text time | timestamp without time zone unique btree (primary key) and on queries like this select * from

Re: [PERFORM] PostgreSQL using the wrong Index

2005-06-13 Thread John A Meinel
Alex Stapleton wrote: Oh, we are running 7.4.2 btw. And our random_page_cost = 1 Which is only correct if your entire db fits into memory. Also, try updating to a later 7.4 version if at all possible. On 13 Jun 2005, at 14:02, Alex Stapleton wrote: We have two index's like so

Re: [PERFORM] PostgreSQL using the wrong Index

2005-06-13 Thread Alex Stapleton
On 13 Jun 2005, at 15:47, John A Meinel wrote: Alex Stapleton wrote: Oh, we are running 7.4.2 btw. And our random_page_cost = 1 Which is only correct if your entire db fits into memory. Also, try updating to a later 7.4 version if at all possible. I am aware of this, I didn't

Re: [PERFORM] PostgreSQL using the wrong Index

2005-06-13 Thread Wei Weng
Tom Lane wrote: This was just covered in excruciating detail yesterday ... You need to write order by symbol desc, time desc limit 1 to get the planner to recognize the connection to the sort order of this index. Since you're only selecting one value of symbol, the actual output