Skip site navigation (1) Skip section navigation (2)

Re: Database tuning

From: "Gregory Wood" <gregw(at)com-stock(dot)com>
To: "K Old" <kevsurf4(at)hotmail(dot)com>
Cc: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Database tuning
Date: 2001-12-21 18:48:03
Message-ID: 00df01c18a50$061a05b0$7889ffcc@comstock.com (view raw or flat)
Thread:
Lists: pgsql-general
> SELECT
> books.book_name, bible.chapter, bible.verse, bible.versetext
> FROM asv_bible bible, book_bible books WHERE bible.book = books.id ORDER
BY
> random() LIMIT 1

> I was wondering if anyone could offer any help with lowering the time it
> takes to run?

I didn't see anything in your schema about an index on asv_bible.book
(book_bible.id is a primary key therefore an index is created implicitly).
Without an index on the book column, the join is going to take some time. I
would put an index on that and do a VACUUM ANALYZE. You should see a huge
speedup from that alone.

Greg


In response to

pgsql-general by date

Next:From: Thomas LockhartDate: 2001-12-21 18:49:53
Subject: Re: How Many Years have Passed?
Previous:From: Gregory WoodDate: 2001-12-21 18:41:33
Subject: Re: Can't use subselect in check constraint

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group