Re: [GENERAL] Trying to get postgres to use an index

2004-11-10 Thread Martijn van Oosterhout
Firstly, check that all your columns are actually of the same type and the indexes are where you say they are. Using \d will show this. Secondly, if you do the EXPLAIN ANALYZE with "set enable_seqscan=off", what is the output? Hope this helps, On Tue, Nov 09, 2004 at 05:02:01PM -0800, Mike Werthe

Re: [GENERAL] Trying to get postgres to use an index

2004-11-09 Thread Mike Wertheim
I have some more info on my indexing situation, and a new question. In my previous email, I told about 2 tables: Notification and Item, which join on a field called ItemID. The joining query didn't execute as quickly as I thought it should. I now notice that I have another table, Folder, which jo

Re: [GENERAL] Trying to get postgres to use an index

2004-11-07 Thread mike
> Well, you're joining the entire two tables, so yes, the seq scan might > be faster. My mistake. When composing the email to state the problem, I accidentally gave a wrong versionof the join query. Here is the corrected version, which still has the sequential scan... explain select notificat

Re: [GENERAL] Trying to get postgres to use an index

2004-11-06 Thread Tom Lane
<[EMAIL PROTECTED]> writes: > Here is the corrected version, which still has the sequential scan... > explain select notificationID from NOTIFICATION n, ITEM i where n.itemID > = i.itemID and i.projectID = 12; > QUERY PLAN >

Re: [GENERAL] Trying to get postgres to use an index

2004-11-06 Thread mike.wertheim
> I'm not a SQL guru by any stretch but would a > constrained sub-select be appropriate here? > Well, you're joining the entire two tables, so yes, the seq scan might > be faster. My mistake! When composing the email to state the problem, I accidentally gave a wrong version of the join query.

Re: [GENERAL] Trying to get postgres to use an index

2004-11-06 Thread Joel Stevenson
At 10:11 PM +0100 11/6/04, Pierre-Frédéric Caillaud wrote: explain select notificationID from NOTIFICATION n, ITEM i where n.itemID = i.itemID; QUERY PLAN -- Hash Join (cost=47162.85..7

Re: [GENERAL] Trying to get postgres to use an index

2004-11-06 Thread Pierre-Frédéric Caillaud
explain select notificationID from NOTIFICATION n, ITEM i where n.itemID = i.itemID; QUERY PLAN -- Hash Join (cost=47162.85..76291.32 rows=223672 width=44) Hash Cond: ("outer".itemid

Re: [GENERAL] Trying to get postgres to use an index

2004-11-06 Thread Troels Arvin
On Sat, 06 Nov 2004 12:00:02 -0800, Mike Wertheim wrote: > Does anyone have any suggestions on how to make this query run faster? Does it help if you decrease the value of random_page_cost? - That value can be changed run-time, from within psql. If you find that a certain, lower value helps, you