Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f62G0va49825 for ; Mon, 2 Jul 2001 12:00:57 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f62FaLI01133 for pgsql-sql@postgresql.org; Mon, 2 Jul 2001 11:36:21 -0400 (EDT) (envelope-from news) From: Dennis X-Newsgroups: comp.databases.postgresql.sql Subject: Multiple Indexes Date: Mon, 2 Jul 2001 09:36:15 -0600 Organization: ZServe Lines: 30 Message-ID: <9hq4dh$13a$1@news.tht.net> Reply-To: dennis@zserve.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: scrappy@hub.org User-Agent: KNode/0.4 To: pgsql-sql@postgresql.org X-Archive-Number: 200107/8 X-Sequence-Number: 3789 Hi Group, Lets say table a has fields: id serial, name varchar(20) not null, and somedata int not null. I'll be doing lots of queries on this table so I'll want to define and index. ( or two? ). Some queries will only look up the name. Others will look up the name depending on somedata. If I were to define and index like this: 1) create index i on sometable ( name, somedata ); and another one like this: 2) create index i2 on sometable ( name ); Would that be better than defining only the first index? What I am asking is: Should I have an index devoted to just the name field, or would that first index work just fine? I know that more indexes means slower time on inserts. Any suggestions appreciated. -Dennis