Database tuning
От | K Old |
---|---|
Тема | Database tuning |
Дата | |
Msg-id | F55Hp0pAa2G335NHsvX00009046@hotmail.com обсуждение исходный текст |
Список | pgsql-general |
Hello all, I have a PostgreSQL database that is storing The Bible. It has 31,103 records in it and I have a PHP page executing this query: 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 The database schema is: /* -------------------------------------------------------- Sequences -------------------------------------------------------- */ CREATE SEQUENCE "book_bible_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; /* -------------------------------------------------------- Table structure for table "asv_bible" -------------------------------------------------------- */ CREATE TABLE "asv_bible" ( "id" int8 NOT NULL, "book" int8, "chapter" int8, "verse" int8, "versetext" text, CONSTRAINT "asv_bible_pkey" PRIMARY KEY ("id") ); /* -------------------------------------------------------- Table structure for table "book_bible" -------------------------------------------------------- */ CREATE TABLE "book_bible" ( "id" int4 DEFAULT nextval('book_bible_seq'::text) NOT NULL, "book_name" varchar(20), CONSTRAINT "book_bible_pkey" PRIMARY KEY ("id") ); Right now it takes 9 seconds to return the results. I don't think that it has anything to do with the language executing it, as I have run the same query in via Perl and had the same luck. I was wondering if anyone could offer any help with lowering the time it takes to run? Am I optimizing the database correctly? My hardware is a Pentium II 400 with 128MB of RAM. Or if this is the normal runtime for a database of this size, I'd just like confirmation. Thanks, Kevin _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com
В списке pgsql-general по дате отправления: