Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 3A44FB02B0F for ; Tue, 20 Mar 2012 02:08:09 -0300 (ADT) Received: from mail-qa0-f46.google.com ([209.85.216.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S9rIm-0007l8-GV for pgsql-hackers@postgresql.org; Tue, 20 Mar 2012 05:08:08 +0000 Received: by qaeb19 with SMTP id b19so1048803qae.19 for ; Mon, 19 Mar 2012 22:07:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=OQczlzscNP5kWPwPU+LCJKLNYOjRPhYNuVrSM957sMc=; b=imlQ++gElAlLZwBw9e5k+Jd5R0f1e8qkr3lHogf4acujjdAkSo+wCk5J5gG6lynaer Zp6yMEJWKCo+xqTctPAxvUqCBNXPxX1+TWNIYsHSN16T4B7Tthv+wZMSLFcmbivnuj+G aXOnCGOQCvX0HsBFmSY1+EoGyrTSAWYno1Cr6vDkX3Eq1Loc7yAQEuOUOZkoSucRbwcn 7OSY+OzxwHEMKT4llGS64xgphc6qnF/i1e988ue8C9n8sA2Dao2vUOY9dO72tAKEZq9A JvdFDRoIzrFm8lqU0JMtQkOt1oBr4E0cOI4B8UmgUmIq00v154TCoGvCX512dnB071ky DsTA== Received: by 10.229.135.72 with SMTP id m8mr5526657qct.7.1332220075870; Mon, 19 Mar 2012 22:07:55 -0700 (PDT) Received: from tornado.leadboat.com (ip68-230-222-48.rd.hr.cox.net. [68.230.222.48]) by mx.google.com with ESMTPS id j17sm935252qaj.9.2012.03.19.22.07.54 (version=SSLv3 cipher=OTHER); Mon, 19 Mar 2012 22:07:55 -0700 (PDT) Date: Tue, 20 Mar 2012 01:07:52 -0400 From: Noah Misch To: Marco Nenciarini Cc: pgsql-hackers@postgresql.org Subject: Re: [PATCH] Support for foreign keys with arrays Message-ID: <20120320050752.GA11554@tornado.leadboat.com> References: <4EE31CB9.90005@2ndQuadrant.it> <20111212004506.GB10399@tornado.leadboat.com> <1326568728.2613.16.camel@greygoo.devise-it.lan> <20120121204223.GA2388@tornado.leadboat.com> <4F280EFE.1080604@2ndQuadrant.it> <1328551482.3354.64.camel@greygoo.devise-it.lan> <20120225020135.GA27204@tornado.leadboat.com> <1331748188.6744.15.camel@greygoo.devise-it.lan> <20120317033312.GB19556@tornado.leadboat.com> <1332178899.2278.4.camel@greygoo.devise-it.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1332178899.2278.4.camel@greygoo.devise-it.lan> User-Agent: Mutt/1.5.18 (2008-05-17) X-Gm-Message-State: ALoCoQl+eKm+qLoAamtenkMq6DAOuvwHOQu4AhcG99b8ehhtopbZrOb9csSuZ68VJ+qyqxQg2R8s X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201203/1266 X-Sequence-Number: 205148 On Mon, Mar 19, 2012 at 06:41:39PM +0100, Marco Nenciarini wrote: > Attached is v5, which should address all the remaining issues. Looks clean to me. > On Fri, Mar 16, 2012 at 11:33:12PM -0400, Noah Misch wrote: > > If the cost doesn't exceed O(F log P), where F is the size of the FK table and > > P is the size of the PK table, I'm not worried. If it can be O(F^2), we would > > have a problem to be documented, if not fixed. > > We have rewritten the old query in a simpler way; now its cost is O(F log P). > Here F must represent the size of the "flattened" table, that is, the total > number of values that must be checked, which seems a reasonable assumption > in any case. Great; I find that approach easier to reason about.