Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id BCCD29FBCBB for ; Mon, 29 Oct 2007 19:56:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 04998-04 for ; Mon, 29 Oct 2007 19:56:24 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from smtpoutm.mac.com (smtpoutm.mac.com [17.148.16.68]) by postgresql.org (Postfix) with ESMTP id 8B7629FB836 for ; Mon, 29 Oct 2007 19:56:28 -0300 (ADT) Received: from mac.com (asmtp001-s [10.150.69.64]) by smtpoutm.mac.com (Xserve/smtpout005/MantshX 4.0) with ESMTP id l9TMuPah022055; Mon, 29 Oct 2007 15:56:25 -0700 (PDT) Received: from il0201b-dhcp87.apple.com (a17-202-15-215.apple.com [17.202.15.215]) (authenticated bits=0) by mac.com (Xserve/asmtp001/MantshX 4.0) with ESMTP id l9TMuN20023612 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 29 Oct 2007 15:56:23 -0700 (PDT) Cc: pgsql-general@postgresql.org Message-Id: <75FEC855-B8E2-4AE7-8B16-C310A0BE4D81@mac.com> From: =?ISO-8859-1?Q?Samantha=A0_Atkins?= To: Richard Huxton In-Reply-To: <4726150C.8000306@archonet.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v912) Subject: Re: A few questions Date: Mon, 29 Oct 2007 15:55:30 -0700 References: <4726150C.8000306@archonet.com> X-Mailer: Apple Mail (2.912) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/1542 X-Sequence-Number: 122834 On Oct 29, 2007, at 10:14 AM, Richard Huxton wrote: > Samantha Atkins wrote: >> First on prepared statements: >> 1) If I am using the libpq are prepared statements tied to a >> connection? In other words can I prepare the statement once and >> use it on multiple connections? > > Per session (connection). > > Temporary tables etc. are the same. > >> 2) What is the logical scope of prepared statement names? Can I >> use the same name on different tables without conflict or is the >> scope database wide or something else? > > Per session. > >> On indices: >> 3) same as 2 for index names. I think they are per table but it is >> worth asking. > > Per database (if you count the schema name). We don't have cross- > table indexes, but the global naming allows it. > >> and last: >> 4) Is it generally better to have more tables in one database from >> a memory and performance point of view or divide into more >> databases if there is a logical division. The reason I ask is that >> I have a situation where one app is used by multiple different >> users each running their own copy. The app uses on the order of 30 >> tables. In some ways it would be convenient to have one big >> database and specialize the table names per user. But I am not >> sure that is most optimal. Is there a general answer to such a >> question? > > Not really, but... > > 1. Do you treat them as separate logical entities? A set of tables per a user, yes. A app process is always for one and only one user. > > Do you want to backup and restore them separately? Not necessarily. Although the is a possibility of wanting separate per-user backups which would pretty much answer the question in this specific case. > > Is any information shared between them? Possible sharing of some common id numbers for common items. Although it is not essential the common items have the same serial number on different databases. > > What are the consequences of a user seeing other users' data? > Little likelihood unless we expose database username/passwd. These are "users" not necessarily represented as postgresql database users. > 2. Are you having performance issues with the most logical design? The first prototype has not yet been completed so no, not yet. :-) > > Can you solve it by adding some more RAM/Disk? ??? There is a desire to use as little ram/disk as possible for the application. I would be interested in what the overhead is for opening a second database. > > What are the maintenance issues with not having the most logical > design? > What do you consider the most logical, one database per user? - samantha