X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4666FD1D5A3 for ; Wed, 19 Nov 2003 07:20:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 14556-04 for ; Wed, 19 Nov 2003 03:20:00 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 6AB44D1C4EE for ; Wed, 19 Nov 2003 03:19:59 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id hAJ7JwO4099188 for ; Wed, 19 Nov 2003 07:19:59 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id hAJ6shbK093495 for pgsql-sql@postgresql.org; Wed, 19 Nov 2003 06:54:43 GMT From: "Randolf Richardson, DevNet SysOp 29" X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Expressional Indexes Date: Wed, 19 Nov 2003 06:54:43 +0000 (UTC) Organization: Inter-Corporate Computer & Network Services, Inc. Lines: 50 Message-ID: References: <7141E2A2-04BE-11D8-81AE-0005029FC1A7@myrealbox.com> <200310221239.58302.josh@agliodbs.com> <18349.1066851898@sss.pgh.pa.us> <200310221322.26013.josh@agliodbs.com> <877k1w6fcv.fsf@stark.dyndns.tv> X-Complaints-To: usenet@news.hub.org User-Agent: Xnews/5.04.25 X-Face: +kXh]8'{:R`HzXla-aT~$s8a+C)k/B%RBr$_3sP`[kA}cl7#mD^9Z:oM`HpoC_kUEH['RZ*Ob%pz\ww^q&x)~zc`.xd]VQ4WN/3t2nS-BvI%LF\B4:\9$EI:/|<)`?8I_; xzG@SOYFir/gk_eB4"Rl43-h%)8O0sR$b&Mp3XHR(0j= X-Face-Author: Randolf Richardson (composed with Adobe Photoshop) To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/236 X-Sequence-Number: 16051 >> For example, if I want to index on a date field but only have the index >> keep track of the most recent 30 days (and then create a secondary >> index for all dates) so as to improve performance on more heavily >> loaded systems. >> >> Am I understanding this new terminology correctly? Thanks in advance. > > No, you could do the above using "partial indexes" but it wouldn't work > very well in this case because the "last 30 days" keeps moving and you > would have to keep redefining the index periodically. For the application I will need to develop in the future, it would be okay for this index to hold data more than 30 days old, and then be redefined on a monthly basis along with regular database vacuuming (and other maintenance). Could this be done with a "partial index" as follows? CREATE INDEX my_index on my_table (create_date) WHERE (create_date > age(timestamp '30 days')); If I've made any mistakes here, please don't hesitate to let me know because the age() function is new to me. > It also wouldn't really help performance. Really? A smaller index would result in fewer comparisons behind-the- scenes though, wouldn't it? > Expression Indexes are just more powerful "functional indexes". In 7.3 > they could be used for indexing expressions like "lower(foo)". In 7.4 > they're more powerful and you can index expressions other than simple > function calls. [sNip] So an "Expression Index" could, for example, be used to sort alpha- numeric data in a case-insensitive manner? I just want to make sure I'm understanding this correctly. Thanks. -- Randolf Richardson - rr@8x.ca Inter-Corporate Computer & Network Services, Inc. Vancouver, British Columbia, Canada http://www.8x.ca/ This message originated from within a secure, reliable, high-performance network ... a Novell NetWare network.