Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 37AB99FB484 for ; Tue, 6 Mar 2007 21:16:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 26812-07 for ; Tue, 6 Mar 2007 21:16:45 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.186]) by postgresql.org (Postfix) with ESMTP id 88D9B9FB4F3 for ; Tue, 6 Mar 2007 21:16:45 -0400 (AST) Received: by nf-out-0910.google.com with SMTP id x4so2721062nfb for ; Tue, 06 Mar 2007 17:16:44 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=fRb+6Py8uc7PJgWIRl8KSOc1ItKuwt99sid4mlX5gIbrL99MEXCkL2OTJnZoZrrYqpADraDGh1Cou4/SRQtLq3l0AfvHSEydJ7yUAEq3nF5rBm4c7J0PTDXfxL/mvTm0nCWqUjibG+W/QWoeJXerc1EQKDF1ziBOJd26k5UH+A8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=e5lSe5ji2v/jna9B9zvYixJ7pGA9C9qasCvOu9HkF4miyll+4l+DqP5MaLUdTT9NTMZ+U9QcUCUQQ3ykU8nOK2FUb4HdvAmUPvhEjHeb4eyc2X9P+gte6XFvshTFGye7N/QON7Qij/H0ND3DXNmLk02EzLd9QCEgQ2eJl/cqPY4= Received: by 10.78.180.18 with SMTP id c18mr897202huf.1173230203768; Tue, 06 Mar 2007 17:16:43 -0800 (PST) Received: by 10.49.36.19 with HTTP; Tue, 6 Mar 2007 17:16:43 -0800 (PST) Message-ID: <9d91f7aa0703061716r3698d2a6jc719916ed5a9d86e@mail.gmail.com> Date: Wed, 7 Mar 2007 09:16:43 +0800 From: calendarw To: "Shane Ambler" Subject: Re: How to union table without union statement? Cc: pgsql-sql@postgresql.org In-Reply-To: <45E6BB42.9070502@Sheeky.Biz> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_125697_16359190.1173230203686" References: <9d91f7aa0702280233r7c91dedav1ddfaffa92877280@mail.gmail.com> <9d91f7aa0702281752o31382827kb33b20848a507938@mail.gmail.com> <45E6BB42.9070502@Sheeky.Biz> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/64 X-Sequence-Number: 27702 ------=_Part_125697_16359190.1173230203686 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I think the tables should contain 50k rows of record and it should be insert 7k rows per month. And the condition of the database is running, so it should not change the tables to partitioning right now. I am looking for some JOIN statement but still doesn't understand how to use JOIN to replace UNION, so dose anyone can give me direction? Thanks. On 3/1/07, Shane Ambler wrote: > > Have you done an EXPLAIN on the query? > Is there an index on the tagname columns? > If so does the EXPLAIN show them being used? > > How many rows do you have in each table (roughly)? > > Have you considered other structure options like partitioning? > Is there a real need to have these tables separate? or could you have > them all in one table with an column to identify the source of the log > entry? > -- Jr. P calendarw ------=_Part_125697_16359190.1173230203686 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I think the tables should contain 50k rows of record and it should be insert 7k rows per month.  And the condition of the database is running, so it should not change the tables to partitioning right now.

I am looking for some JOIN statement but still doesn't understand how to use JOIN to replace UNION, so dose anyone can give me direction?

Thanks.

On 3/1/07, Shane Ambler <pgsql@sheeky.biz> wrote:
Have you done an EXPLAIN on the query?
Is there an index on the tagname columns?
If so does the EXPLAIN show them being used?

How many rows do you have in each table (roughly)?

Have you considered other structure options like partitioning?
Is there a real need to have these tables separate? or could you have
them all in one table with an column to identify the source of the log
entry?

--
Jr. P
calendarw ------=_Part_125697_16359190.1173230203686--