<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-772</id>
	<title>Nabble - PostgreSQL - novice</title>
	<updated>2009-11-30T01:32:18Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/PostgreSQL---novice-f772.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PostgreSQL---novice-f772.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26571676</id>
	<title>Question when to use BEGIN / END</title>
	<published>2009-11-30T01:32:18Z</published>
	<updated>2009-11-30T01:32:18Z</updated>
	<author>
		<name>Rikard Bosnjakovic-2</name>
	</author>
	<content type="html">I have a case where I want to forbid a race condition. Basically, I have this:
&lt;br&gt;&lt;br&gt;$q = &amp;quot;CREATE VIEW foo AS ( SELECT * FROM foo WHERE [...different
&lt;br&gt;conditions every call ...] &amp;nbsp;)&amp;quot;;
&lt;br&gt;@pg_query($db, $q);
&lt;br&gt;$q = &amp;quot;SELECT * FROM foo&amp;quot;;
&lt;br&gt;$res = pg_query($db, $q);
&lt;br&gt;$row = pg_fetch_object($res);
&lt;br&gt;... change table foo...
&lt;br&gt;$q = &amp;quot;DROP VIEW foo&amp;quot;;
&lt;br&gt;@pg_query($db, $q);
&lt;br&gt;&lt;br&gt;It is of utmost importance that there is not another client doing the
&lt;br&gt;same thing while the above is running. When the DROP VIEW is done,
&lt;br&gt;another client can start its work but not until then.
&lt;br&gt;&lt;br&gt;I'm reading about BEGIN/END on
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/docs/7.4/interactive/sql-begin.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/docs/7.4/interactive/sql-begin.html&lt;/a&gt;&amp;nbsp;but I'm
&lt;br&gt;not sure this is the solution. What I'm wondering is this: If I
&lt;br&gt;prepend BEGIN on CREATE VIEW above, and append END after DROP VIEW,
&lt;br&gt;can I still access the table foo in between? Or is BEGIN/END only
&lt;br&gt;supposed to be used on queries that do INSERT or UPDATE, i.e. no
&lt;br&gt;data-reading?
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;- Rikard
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26571676&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Question-when-to-use-BEGIN---END-tp26571676p26571676.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26562530</id>
	<title>Re: bytea and text</title>
	<published>2009-11-29T06:30:57Z</published>
	<updated>2009-11-29T06:30:57Z</updated>
	<author>
		<name>Jean-Yves F. Barbier-2</name>
	</author>
	<content type="html">Kris Kewley a écrit :
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Some interesting points were made. Depending on the roadmap for you
&lt;br&gt;&amp;gt; application consideration should be given to storing the image files
&lt;br&gt;&amp;gt; outside of the db.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; IMO the driving factors here are:
&lt;br&gt;&amp;gt; 1. Scalability
&lt;br&gt;&amp;gt; 2. Version control of images
&lt;br&gt;&amp;gt; 3. Backup
&lt;br&gt;&amp;gt; 4. Performance
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Including images in your db will accerlate it's growth. You noted legal
&lt;br&gt;&amp;gt; concerns, version control is typically an important aspect of this. Back
&lt;br&gt;&amp;gt; up and restore time will increase as db size is larger, and will be more
&lt;br&gt;&amp;gt; costly (assume db on more expensive disk than file server). Finally
&lt;br&gt;&amp;gt; performance.. Blobs typically increase disk io on queries (at least they
&lt;br&gt;&amp;gt; do in oracle) so should be used judicially in heavily accessed tables.
&lt;/div&gt;&lt;br&gt;These tables are not heavily accessed: they're linked to heavily accessed
&lt;br&gt;other tables.
&lt;br&gt;They only contains an id, a RI, a pic_nb and a bytea.
&lt;br&gt;Pictures are practically never upgraded and jettisoned when obsolete.
&lt;br&gt;&lt;br&gt;&amp;gt; Realize that I have made some wild assumptions about your app here, but
&lt;br&gt;&amp;gt; this is my experience.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Consider a link in your db and using cvs for storing the images, or
&lt;br&gt;&amp;gt; filesystem depending on the extent of to your needs.
&lt;br&gt;&lt;br&gt;NO, I want only one backup solution, not one for each case; and perfs are
&lt;br&gt;only needed for other tables.
&lt;br&gt;&lt;br&gt;&amp;gt; I too stand to be corrected :-)
&lt;br&gt;&lt;br&gt;I see, you're doing BDSM :D
&lt;br&gt;&lt;br&gt;JY
&lt;br&gt;-- 
&lt;br&gt;Leave no stone unturned.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -- Euripides
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26562530&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26562530.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26562156</id>
	<title>Re: bytea and text</title>
	<published>2009-11-29T05:41:58Z</published>
	<updated>2009-11-29T05:41:58Z</updated>
	<author>
		<name>Kris Kewley</name>
	</author>
	<content type="html">Some interesting points were made. Depending on the roadmap for you &amp;nbsp;
&lt;br&gt;application consideration should be given to storing the image files &amp;nbsp;
&lt;br&gt;outside of the db.
&lt;br&gt;&lt;br&gt;IMO the driving factors here are:
&lt;br&gt;1. Scalability
&lt;br&gt;2. Version control of images
&lt;br&gt;3. Backup
&lt;br&gt;4. Performance
&lt;br&gt;&lt;br&gt;Including images in your db will accerlate it's growth. You noted &amp;nbsp;
&lt;br&gt;legal concerns, version control is typically an important aspect of &amp;nbsp;
&lt;br&gt;this. Back up and restore time will increase as db size is larger, and &amp;nbsp;
&lt;br&gt;will be more costly (assume db on more expensive disk than file &amp;nbsp;
&lt;br&gt;server). Finally performance.. Blobs typically increase disk io on &amp;nbsp;
&lt;br&gt;queries (at least they do in oracle) so should be used judicially in &amp;nbsp;
&lt;br&gt;heavily accessed tables.
&lt;br&gt;&lt;br&gt;Realize that I have made some wild assumptions about your app here, &amp;nbsp;
&lt;br&gt;but this is my experience.
&lt;br&gt;&lt;br&gt;Consider a link in your db and using cvs for storing the images, or &amp;nbsp;
&lt;br&gt;filesystem depending on the extent of to your needs.
&lt;br&gt;&lt;br&gt;I too stand to be corrected :-)
&lt;br&gt;Kris
&lt;br&gt;&lt;br&gt;&lt;br&gt;On 29-Nov-09, at 3:30, richard terry &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26562156&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rterry@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Sunday 29 November 2009 17:50:10 Didier Gasser-Morlay wrote:
&lt;br&gt;&amp;gt;&amp;gt; I hope you won't mind if I had my 2 cents to this conversation; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; aside from
&lt;br&gt;&amp;gt;&amp;gt; the actual format, this question comes up with regularity on various
&lt;br&gt;&amp;gt;&amp;gt; database lists.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I have never understood the need for storing images inside a &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; database (and
&lt;br&gt;&amp;gt;&amp;gt; to some extend blob data) because:
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;- being a blog you do not query it just store and retrieve, you &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; rarely
&lt;br&gt;&amp;gt;&amp;gt; update, so the need for a fancy SQL and DB engine is somewhat &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; limited;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;- storing images is heavy, makes the database grow, thus makes
&lt;br&gt;&amp;gt;&amp;gt; backup/restore that bit more painful and possibly that bit less &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; stable. ..
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; For years I designed system for picture libraries where numbers &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; like 10s of
&lt;br&gt;&amp;gt;&amp;gt; thousands to millions of images are common place, we would never have
&lt;br&gt;&amp;gt;&amp;gt; contemplated to store images on anything more complex than a file &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; system.
&lt;br&gt;&amp;gt;&amp;gt; using the database to store a URL to that resource.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Hope this helps
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Didier
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; this is **mission critical** for me (alone perhaps) as the images &amp;nbsp;
&lt;br&gt;&amp;gt; (usually
&lt;br&gt;&amp;gt; very small &amp;nbsp;(eg many could be 15K for a small photo, 3k - 16K for a &amp;nbsp;
&lt;br&gt;&amp;gt; small
&lt;br&gt;&amp;gt; diagram of a body part) are part of some medical record software I'm &amp;nbsp;
&lt;br&gt;&amp;gt; writing
&lt;br&gt;&amp;gt; for myself, and sit in the progress notes when displayed. &amp;nbsp;Just &amp;nbsp;
&lt;br&gt;&amp;gt; alteration of
&lt;br&gt;&amp;gt; a line drawn on a body part for an injured patient could end you up &amp;nbsp;
&lt;br&gt;&amp;gt; in court
&lt;br&gt;&amp;gt; or de-registered.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Medico-legal issues abound.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Yes, one can easily backup files in a directory, but my current &amp;nbsp;
&lt;br&gt;&amp;gt; feeling is its
&lt;br&gt;&amp;gt; easier to do an entire DB dump - could be wrong, stand to be &amp;nbsp;
&lt;br&gt;&amp;gt; corrected.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Regards
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Richard
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26562156&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;&amp;gt; To make changes to your subscription:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26562156&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26562156.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26561141</id>
	<title>Fwd: Re: bytea and text</title>
	<published>2009-11-29T03:29:51Z</published>
	<updated>2009-11-29T03:29:51Z</updated>
	<author>
		<name>Syan Tan-2</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 	
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;sorry, just have faulty memory from doing it months ago with both derbydb and
&lt;br&gt;postgresql as
&lt;br&gt;alternative drivers. Derbydb was the one that preferred intermediate files for
&lt;br&gt;bulk loading of
&lt;br&gt;binary stuff as hex &amp;nbsp;I think but there was no delimiters apart from comma for
&lt;br&gt;that , whereas 
&lt;br&gt;postgresql allows you to escape every character as a slash followed by 1-3 digit
&lt;br&gt;octal or 1-2 digit hex preceded
&lt;br&gt;by a slash and a x , so that was the point of the question, whether is it better
&lt;br&gt;to be paranoid that a 
&lt;br&gt;bulk load is going to fail and escape every character, or can you be optimistic
&lt;br&gt;an just escape
&lt;br&gt;newline carriage return , backslash itself and the current delimiter character ,
&lt;br&gt;but is there an end of file
&lt;br&gt;sequence ? and doing you have to escape the null sequence ? \N if it happens to
&lt;br&gt;occur in your raw binary data.
&lt;br&gt;If a 3 gig bulk load fails because of one character, it's annoying.
&lt;br&gt;&amp;nbsp; &amp;nbsp;I remember doing the same thing as individual pgdb api calls a few years ago, 
&lt;br&gt;and having no such problem in python with binary data , or at least you could
&lt;br&gt;fail one image and not have it affect the rest of the rows by having autocommit on.
&lt;br&gt;&lt;br&gt;&lt;br&gt;On Sat 28/11/09 13:19 , Bob McConnell &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26561141&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rmcconne@...&lt;/a&gt; sent:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Syan Tan wrote:
&lt;br&gt;&amp;gt; &amp;gt; here's a quote from the postgresql
&lt;br&gt;&amp;gt; documentation&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; Backslash characters (\) can be used in the COPY
&lt;br&gt;&amp;gt; data to quote data&amp;gt; characters that might otherwise be taken as row
&lt;br&gt;&amp;gt; or column delimiters.&amp;gt; In particular, the following characters must be
&lt;br&gt;&amp;gt; preceded by a&amp;gt; backslash if they appear as part of a column
&lt;br&gt;&amp;gt; value: backslash itself,&amp;gt; newline, carriage return, and the current
&lt;br&gt;&amp;gt; delimiter character.&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; So if I scan a field value ( say a big buffer to
&lt;br&gt;&amp;gt; hold an entire&amp;gt; image), and have a second buffer to copy an
&lt;br&gt;&amp;gt; escaped image string to ,&amp;gt; and I read one of the 4 characters mentioned
&lt;br&gt;&amp;gt; above, and insert a&amp;gt; backslash into the destination buffer, and then
&lt;br&gt;&amp;gt; continue copying into&amp;gt; the second buffer, I should end up with a string
&lt;br&gt;&amp;gt; that I can put&amp;gt; inside a comma-separated text file ( so comma =
&lt;br&gt;&amp;gt; the current delimiter&amp;gt; character ), and then I can bulk load a huge
&lt;br&gt;&amp;gt; text file containing&amp;gt; thousands of images without problems using
&lt;br&gt;&amp;gt; COPY..FROM , is that &amp;gt; correct ?
&lt;br&gt;&amp;gt; &amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; On Sat 28/11/09 01:29 , &amp;quot;Tom Lane&amp;quot; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26561141&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tgl@...&lt;/a&gt;
&lt;br&gt;&amp;gt; .pa.us sent:&amp;gt;&amp;gt; richard terry 
&lt;br&gt;&amp;gt; writes:&amp;gt; tom, I wonder if&amp;gt;&amp;gt; you could give us a sample of using client
&lt;br&gt;&amp;gt; side lo_creat , &amp;gt; insert&amp;gt;&amp;gt; functions to insert a blob into postgres -
&lt;br&gt;&amp;gt; in an sql statement. &amp;gt;&amp;gt; There's an example program in the docs:
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/docs/8.4/static/lo-examplesect.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/docs/8.4/static/lo-examplesect.html&lt;/a&gt;&amp;nbsp;&amp;gt;&amp;gt; regards,
&lt;/div&gt;tom lane
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; It is my understanding that the current SQL standard defines the single
&lt;br&gt;&amp;gt; quote as the official escape character. While the DB engine accepts 
&lt;br&gt;&amp;gt; others, wouldn't it be best to use the official character?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Bob McConnell
&lt;br&gt;&amp;gt; N2SPP
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; Sent via pgsql-novice mailing list (p
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26561141&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gsql-novice@...&lt;/a&gt;)To make changes to your subscription:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26561141&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Fwd%3A-Re%3A-bytea-and-text-tp26561141p26561141.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26560149</id>
	<title>Re: bytea and text</title>
	<published>2009-11-29T00:34:28Z</published>
	<updated>2009-11-29T00:34:28Z</updated>
	<author>
		<name>Jasen Betts-5</name>
	</author>
	<content type="html">On 2009-11-29, Didier Gasser-Morlay &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26560149&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;didiergm@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; --0016e6dab093a91c6704797cefd5
&lt;br&gt;&amp;gt; Content-Type: text/plain; charset=ISO-8859-1
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I hope you won't mind if I had my 2 cents to this conversation; aside from
&lt;br&gt;&amp;gt; the actual format, this question comes up with regularity on various
&lt;br&gt;&amp;gt; database lists.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I have never understood the need for storing images inside a database (and
&lt;br&gt;&amp;gt; to some extend blob data) because:
&lt;br&gt;&amp;gt; &amp;nbsp; - being a blog you do not query it just store and retrieve, you rarely
&lt;br&gt;&amp;gt; update, so the need for a fancy SQL and DB engine is somewhat limited;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; - storing images is heavy, makes the database grow, thus makes
&lt;br&gt;&amp;gt; backup/restore that bit more painful and possibly that bit less stable. ..
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; For years I designed system for picture libraries where numbers like 10s of
&lt;br&gt;&amp;gt; thousands to millions of images are common place, we would never have
&lt;br&gt;&amp;gt; contemplated to store images on anything more complex than a file system.
&lt;br&gt;&amp;gt; using the database to store a URL to that resource.
&lt;/div&gt;&lt;br&gt;ON DELETE CASCADE doesn't work for disk files.
&lt;br&gt;&lt;br&gt;all the applications that need the images need to ba able to
&lt;br&gt;contact the server for the files.
&lt;br&gt;&lt;br&gt;only need to backup one thing.
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26560149&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26560149.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26560146</id>
	<title>Re: bytea and text</title>
	<published>2009-11-29T00:30:51Z</published>
	<updated>2009-11-29T00:30:51Z</updated>
	<author>
		<name>richard terry-5</name>
	</author>
	<content type="html">On Sunday 29 November 2009 17:50:10 Didier Gasser-Morlay wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I hope you won't mind if I had my 2 cents to this conversation; aside from
&lt;br&gt;&amp;gt; the actual format, this question comes up with regularity on various
&lt;br&gt;&amp;gt; database lists.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I have never understood the need for storing images inside a database (and
&lt;br&gt;&amp;gt; to some extend blob data) because:
&lt;br&gt;&amp;gt; &amp;nbsp; - being a blog you do not query it just store and retrieve, you rarely
&lt;br&gt;&amp;gt; update, so the need for a fancy SQL and DB engine is somewhat limited;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; - storing images is heavy, makes the database grow, thus makes
&lt;br&gt;&amp;gt; backup/restore that bit more painful and possibly that bit less stable. ..
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; For years I designed system for picture libraries where numbers like 10s of
&lt;br&gt;&amp;gt; thousands to millions of images are common place, we would never have
&lt;br&gt;&amp;gt; contemplated to store images on anything more complex than a file system.
&lt;br&gt;&amp;gt; using the database to store a URL to that resource.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Hope this helps
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Didier
&lt;br&gt;&amp;gt; 
&lt;/div&gt;this is **mission critical** for me (alone perhaps) as the images (usually 
&lt;br&gt;very small &amp;nbsp;(eg many could be 15K for a small photo, 3k - 16K for a small 
&lt;br&gt;diagram of a body part) are part of some medical record software I'm writing 
&lt;br&gt;for myself, and sit in the progress notes when displayed. &amp;nbsp;Just alteration of 
&lt;br&gt;a line drawn on a body part for an injured patient could end you up in court 
&lt;br&gt;or de-registered.
&lt;br&gt;&lt;br&gt;Medico-legal issues abound.
&lt;br&gt;&lt;br&gt;Yes, one can easily backup files in a directory, but my current feeling is its 
&lt;br&gt;easier to do an entire DB dump - could be wrong, stand to be corrected.
&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;&lt;br&gt;Richard
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26560146&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26560146.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26559877</id>
	<title>Re: Problem loading data from Intro to Postgis</title>
	<published>2009-11-28T23:24:16Z</published>
	<updated>2009-11-28T23:24:16Z</updated>
	<author>
		<name>Tim Clark</name>
	</author>
	<content type="html">Thanks Tom, I will repost on the postgis list.
&lt;br&gt;&lt;br&gt;Tim
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Tim Clark
&lt;br&gt;Department of Zoology 
&lt;br&gt;University of Hawaii
&lt;br&gt;&lt;br&gt;&lt;br&gt;--- On Sat, 11/28/09, Tom Lane &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26559877&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tgl@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; From: Tom Lane &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26559877&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tgl@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; Subject: Re: [NOVICE] Problem loading data from Intro to Postgis
&lt;br&gt;&amp;gt; To: &amp;quot;Tim Clark&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26559877&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mudiver1200@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; Cc: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26559877&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;
&lt;br&gt;&amp;gt; Date: Saturday, November 28, 2009, 7:10 PM
&lt;br&gt;&amp;gt; Tim Clark &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26559877&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mudiver1200@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; &amp;gt; I just installed postgis and am trying to work through
&lt;br&gt;&amp;gt; the Introduction to Postgis workhop at 
&lt;br&gt;&amp;gt; &amp;gt; &lt;a href=&quot;http://2007.foss4g.org/workshops/W-04/PostGIS%20Workshop.doc#_Toc177458966&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://2007.foss4g.org/workshops/W-04/PostGIS%20Workshop.doc#_Toc177458966&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You'd probably be best off to ask about that on the postgis
&lt;br&gt;&amp;gt; mailing
&lt;br&gt;&amp;gt; lists.  I'm not sure any of that crowd read
&lt;br&gt;&amp;gt; pgsql-novice.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;            
&lt;br&gt;&amp;gt; regards, tom lane
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26559877&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-loading-data-from-Intro-to-Postgis-tp26559374p26559877.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26559871</id>
	<title>Re: bytea and text</title>
	<published>2009-11-28T23:23:31Z</published>
	<updated>2009-11-28T23:23:31Z</updated>
	<author>
		<name>Didier Gasser-Morlay-2</name>
	</author>
	<content type="html">&lt;pre&gt;&amp;gt; this is not a blog, but pictures aren&amp;#39;t updated&lt;br&gt;Sorry I meant &amp;quot;blob&amp;quot;, I guess it was not obvious,&lt;br&gt;&lt;br&gt;&amp;gt;hmmmm, just a one shot backup for &amp;quot;just users&amp;quot;.&lt;br&gt;hmmmm never heard of backup scripts ? &lt;br&gt;
&lt;br&gt;&amp;gt;I&amp;#39;m not going to feed this troll, this is MY choice.&lt;br&gt;Not trolling, trying to help by sharing experience, which I thought was the purpose of this list.&lt;br&gt;I do apologize for interrupting your thought process&lt;br&gt;
&lt;/pre&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26559871.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26559744</id>
	<title>Re: bytea and text</title>
	<published>2009-11-28T22:55:40Z</published>
	<updated>2009-11-28T22:55:40Z</updated>
	<author>
		<name>Jean-Yves F. Barbier-2</name>
	</author>
	<content type="html">Didier Gasser-Morlay a écrit :
&lt;br&gt;&amp;gt; I hope you won't mind if I had my 2 cents to this conversation; aside
&lt;br&gt;&amp;gt; from the actual format, this question comes up with regularity on
&lt;br&gt;&amp;gt; various database lists.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I have never understood the need for storing images inside a database
&lt;br&gt;&amp;gt; (and to some extend blob data) because:
&lt;br&gt;&amp;gt; &amp;nbsp; - being a blog you do not query it just store and retrieve, you rarely
&lt;br&gt;&amp;gt; update, so the need for a fancy SQL and DB engine is somewhat limited;
&lt;br&gt;&lt;br&gt;this is not a blog, but pictures aren't updated
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;gt; &amp;nbsp; - storing images is heavy, makes the database grow, thus makes
&lt;br&gt;&amp;gt; backup/restore that bit more painful and possibly that bit less stable. ..
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^^^^^^^^^^^^^^^^^^^^
&lt;br&gt;?
&lt;br&gt;&lt;br&gt;&amp;gt; For years I designed system for picture libraries where numbers like 10s
&lt;br&gt;&amp;gt; of thousands to millions of images are common place, we would never have
&lt;br&gt;&amp;gt; contemplated to store images on anything more complex than a file
&lt;br&gt;&amp;gt; system. using the database to store a URL to that resource.
&lt;br&gt;&lt;br&gt;hmmmm, just a one shot backup for &amp;quot;just users&amp;quot;.
&lt;br&gt;&lt;br&gt;I'm not going to feed this troll, this is MY choice.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Being stoned on marijuana isn't very different from being stoned on gin.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -- Ralph Nader
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26559744&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26559744.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26559720</id>
	<title>Re: bytea and text</title>
	<published>2009-11-28T22:50:10Z</published>
	<updated>2009-11-28T22:50:10Z</updated>
	<author>
		<name>Didier Gasser-Morlay-2</name>
	</author>
	<content type="html">I hope you won&amp;#39;t mind if I had my 2 cents to this conversation; aside from the actual format, this question comes up with regularity on various database lists. &lt;br&gt;&lt;br&gt;I have never understood the need for storing images inside a database (and to some extend blob data) because:&lt;br&gt;
  - being a blog you do not query it just store and retrieve, you rarely update, so the need for a fancy SQL and DB engine is somewhat limited;&lt;br&gt; &lt;br&gt;  - storing images is heavy, makes the database grow, thus makes backup/restore that bit more painful and possibly that bit less stable. .. &lt;br&gt;
&lt;br&gt;For years I designed system for picture libraries where numbers like 10s of thousands to millions of images are common place, we would never have contemplated to store images on anything more complex than a file system. using the database to store a URL to that resource. &lt;br&gt;
&lt;br&gt;Hope this helps&lt;br&gt;&lt;br&gt;Didier&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26559720.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26559418</id>
	<title>Re: Problem loading data from Intro to Postgis</title>
	<published>2009-11-28T21:10:12Z</published>
	<updated>2009-11-28T21:10:12Z</updated>
	<author>
		<name>Tom Lane-2</name>
	</author>
	<content type="html">Tim Clark &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26559418&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mudiver1200@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; I just installed postgis and am trying to work through the Introduction to Postgis workhop at 
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://2007.foss4g.org/workshops/W-04/PostGIS%20Workshop.doc#_Toc177458966&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://2007.foss4g.org/workshops/W-04/PostGIS%20Workshop.doc#_Toc177458966&lt;/a&gt;&lt;br&gt;&lt;br&gt;You'd probably be best off to ask about that on the postgis mailing
&lt;br&gt;lists. &amp;nbsp;I'm not sure any of that crowd read pgsql-novice.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26559418&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-loading-data-from-Intro-to-Postgis-tp26559374p26559418.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26559374</id>
	<title>Problem loading data from Intro to Postgis</title>
	<published>2009-11-28T20:57:15Z</published>
	<updated>2009-11-28T20:57:15Z</updated>
	<author>
		<name>Tim Clark</name>
	</author>
	<content type="html">Dear List,
&lt;br&gt;&lt;br&gt;I just installed postgis and am trying to work through the Introduction to Postgis workhop at 
&lt;br&gt;&lt;a href=&quot;http://2007.foss4g.org/workshops/W-04/PostGIS%20Workshop.doc#_Toc177458966&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://2007.foss4g.org/workshops/W-04/PostGIS%20Workshop.doc#_Toc177458966&lt;/a&gt;&lt;br&gt;&lt;br&gt;I have postgis and postgresql installed on a Dell Inspiron 5150 running Windows XP. &amp;nbsp;My problem is that I can't get any data into the database. &amp;nbsp;I have gotten to page 26-27, loading shapefiles. &amp;nbsp;I have run the pg_setenv.bat file at the windows command prompt and it seems to have set up the path correctly. &amp;nbsp;I have looked in the postgresql bin directory and the proper commands are in the folder. &amp;nbsp;However, when I run the given shp2pgsql or psql commands I get an error that the command &amp;quot;is not recognized as an internal or external command, operable program or batch file.&amp;quot;
&lt;br&gt;&lt;br&gt;I would appreciate any help or suggestions you could give to gelp me past page 27!
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;Tim
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;C:\postgis_workshop\data&amp;gt;dir
&lt;br&gt;&amp;nbsp;Volume in drive C has no label.
&lt;br&gt;&amp;nbsp;Volume Serial Number is 6071-6A25
&lt;br&gt;&lt;br&gt;&amp;nbsp;Directory of C:\postgis_workshop\data
&lt;br&gt;&lt;br&gt;11/28/2009 &amp;nbsp;05:55 PM &amp;nbsp; &amp;nbsp;&amp;lt;DIR&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.
&lt;br&gt;11/28/2009 &amp;nbsp;05:55 PM &amp;nbsp; &amp;nbsp;&amp;lt;DIR&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;..
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;31,260 bc_border.dbf
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 170 bc_border.prj
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,196,124 bc_border.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;41,692 bc_border.shx
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3,298 bc_hospitals.dbf
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 431 bc_hospitals.prj
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,332 bc_hospitals.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 452 bc_hospitals.shx
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7,388 bc_municipality.dbf
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 431 bc_municipality.prj
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 278,184 bc_municipality.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,396 bc_municipality.shx
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;63,193 bc_pubs.dbf
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 431 bc_pubs.prj
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10,576 bc_pubs.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3,436 bc_pubs.shx
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6,690,323 bc_roads.dbf
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 431 bc_roads.prj
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19,687,612 bc_roads.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,305,516 bc_roads.shx
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,544 bc_roads.sld
&lt;br&gt;08/23/2007 &amp;nbsp;08:01 PM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,206,304 bc_voting_areas.dbf
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 431 bc_voting_areas.prj
&lt;br&gt;08/23/2007 &amp;nbsp;08:01 PM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12,586,104 bc_voting_areas.shp
&lt;br&gt;08/23/2007 &amp;nbsp;08:01 PM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;63,988 bc_voting_areas.shx
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 532,252 cities.dbf
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 142 cities.prj
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;71,024 cities.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 141,281 cities.shp.xml
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20,364 cities.shx
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;14,551 countries.dbf
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 142 countries.prj
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,537,144 countries.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,772 countries.shx
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6,263 countries.sld
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;48,914 newyork_census.dbf
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;69,652 newyork_census.htm
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 570 newyork_census.prj
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3,662,668 newyork_census.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;17,828 newyork_census.shx
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 122,367 nnewyork_census.xml
&lt;br&gt;08/22/2007 &amp;nbsp;01:16 PM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;55 pg_setenv.bat
&lt;br&gt;08/22/2007 &amp;nbsp;01:16 PM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 402 pg_shpsql.bat
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 332 timezone.dbf
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 142 timezone.prj
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 466,308 timezone.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 136,399 timezone.shp.xml
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 404 timezone.shx
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,165 timezone.sld
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,327,200 usa_counties.dbf
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 164 usa_counties.prj
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,518,248 usa_counties.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;25,228 usa_counties.shx
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 53 File(s) &amp;nbsp; &amp;nbsp; 52,905,028 bytes
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 Dir(s) &amp;nbsp;18,336,935,936 bytes free
&lt;br&gt;&lt;br&gt;C:\postgis_workshop\data&amp;gt;pg_setenv.bat
&lt;br&gt;&lt;br&gt;C:\postgis_workshop\data&amp;gt;SET PATH=&amp;quot;C:\Program Files\PostgreSQL\8.2\bin&amp;quot;;C:\Progr
&lt;br&gt;am Files\MiKTeX 2.7\miktex\bin;C:\Perl\site\bin;C:\Perl\bin;C:\WINDOWS\system32;
&lt;br&gt;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\MATLAB7\bin\win32;C:\PROGRA~1\AUTOSI~1.7;
&lt;br&gt;C:\Program Files\QuickTime\QTSystem\
&lt;br&gt;&lt;br&gt;C:\postgis_workshop\data&amp;gt;dir *.shp
&lt;br&gt;&amp;nbsp;Volume in drive C has no label.
&lt;br&gt;&amp;nbsp;Volume Serial Number is 6071-6A25
&lt;br&gt;&lt;br&gt;&amp;nbsp;Directory of C:\postgis_workshop\data
&lt;br&gt;&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,196,124 bc_border.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,332 bc_hospitals.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 278,184 bc_municipality.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10,576 bc_pubs.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19,687,612 bc_roads.shp
&lt;br&gt;08/23/2007 &amp;nbsp;08:01 PM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12,586,104 bc_voting_areas.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;71,024 cities.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,537,144 countries.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3,662,668 newyork_census.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 466,308 timezone.shp
&lt;br&gt;06/26/2007 &amp;nbsp;11:15 AM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1,518,248 usa_counties.shp
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 11 File(s) &amp;nbsp; &amp;nbsp; 41,015,324 bytes
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 Dir(s) &amp;nbsp;18,336,935,936 bytes free
&lt;br&gt;&lt;br&gt;C:\postgis_workshop\data&amp;gt;shp2pgsql -i -D -s 3005 bc_pubs.shp bc_pubs &amp;gt; bc_pubs.s
&lt;br&gt;ql
&lt;br&gt;'shp2pgsql' is not recognized as an internal or external command,
&lt;br&gt;operable program or batch file.
&lt;br&gt;&lt;br&gt;C:\postgis_workshop\data&amp;gt;psql -U postgres -f bc_pubs.sql -d postgis
&lt;br&gt;'psql' is not recognized as an internal or external command,
&lt;br&gt;operable program or batch file.
&lt;br&gt;&lt;br&gt;C:\postgis_workshop\data&amp;gt;psql
&lt;br&gt;'psql' is not recognized as an internal or external command,
&lt;br&gt;operable program or batch file.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Tim Clark
&lt;br&gt;Department of Zoology 
&lt;br&gt;University of Hawaii
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26559374&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-loading-data-from-Intro-to-Postgis-tp26559374p26559374.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26553072</id>
	<title>Re: bytea and text</title>
	<published>2009-11-28T05:19:15Z</published>
	<updated>2009-11-28T05:19:15Z</updated>
	<author>
		<name>Bob McConnell-2</name>
	</author>
	<content type="html">Syan Tan wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; here's a quote from the postgresql documentation
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Backslash characters (\) can be used in the COPY data to quote data
&lt;br&gt;&amp;gt; characters that might otherwise be taken as row or column delimiters.
&lt;br&gt;&amp;gt; In particular, the following characters must be preceded by a
&lt;br&gt;&amp;gt; backslash if they appear as part of a column value: backslash itself,
&lt;br&gt;&amp;gt; newline, carriage return, and the current delimiter character.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; So if I scan a field value ( say a big buffer to hold an entire
&lt;br&gt;&amp;gt; image), and have a second buffer to copy an escaped image string to ,
&lt;br&gt;&amp;gt; and I read one of the 4 characters mentioned above, and insert a
&lt;br&gt;&amp;gt; backslash into the destination buffer, and then continue copying into
&lt;br&gt;&amp;gt; the second buffer, I should end up with a string that I can put
&lt;br&gt;&amp;gt; inside a comma-separated text file ( so comma = the current delimiter
&lt;br&gt;&amp;gt; character ), and then I can bulk load a huge text file containing
&lt;br&gt;&amp;gt; thousands of images without problems using COPY..FROM , is that 
&lt;br&gt;&amp;gt; correct ?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; On Sat 28/11/09 01:29 , &amp;quot;Tom Lane&amp;quot; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26553072&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tgl@...&lt;/a&gt; sent:
&lt;br&gt;&amp;gt;&amp;gt; richard terry &amp;lt;rterry@ pacific.net.au&amp;gt; writes:&amp;gt; tom, I wonder if
&lt;br&gt;&amp;gt;&amp;gt; you could give us a sample of using client side lo_creat , &amp;gt; insert
&lt;br&gt;&amp;gt;&amp;gt; functions to insert a blob into postgres - in an sql statement. 
&lt;br&gt;&amp;gt;&amp;gt; There's an example program in the docs: 
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/docs/8.4/static/lo-examplesect.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/docs/8.4/static/lo-examplesect.html&lt;/a&gt;&amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; regards, tom lane
&lt;/div&gt;&lt;br&gt;It is my understanding that the current SQL standard defines the single 
&lt;br&gt;quote as the official escape character. While the DB engine accepts 
&lt;br&gt;others, wouldn't it be best to use the official character?
&lt;br&gt;&lt;br&gt;Bob McConnell
&lt;br&gt;N2SPP
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26553072&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26553072.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26550796</id>
	<title>Re: bytea and text</title>
	<published>2009-11-27T22:24:15Z</published>
	<updated>2009-11-27T22:24:15Z</updated>
	<author>
		<name>Syan Tan-2</name>
	</author>
	<content type="html">&lt;br&gt;here's a quote from the postgresql documentation
&lt;br&gt;&lt;br&gt;Backslash characters (\) can be used in the COPY data to quote data characters that might otherwise be taken as 
&lt;br&gt;row or column delimiters. In particular, the following characters must be preceded by a backslash if they appear 
&lt;br&gt;as part of a column value: backslash itself, newline, carriage return, and the current delimiter character.
&lt;br&gt;&lt;br&gt;So if I scan a field value ( say a big buffer to hold an entire image), and have a second buffer to copy 
&lt;br&gt;an escaped image string to , and I read one of the 4 characters mentioned above, and insert a backslash
&lt;br&gt;into the destination buffer, and then continue copying into the second buffer, I should end up with a string
&lt;br&gt;that I can put inside a comma-separated text file ( so comma = the current delimiter character ), and then
&lt;br&gt;I can bulk load a huge text file containing thousands of images without problems using COPY..FROM , is that
&lt;br&gt;correct ?
&lt;br&gt;&lt;br&gt;&lt;br&gt;On Sat 28/11/09 01:29 , &amp;quot;Tom Lane&amp;quot; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26550796&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tgl@...&lt;/a&gt; sent:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; richard terry &amp;lt;rterry@
&lt;br&gt;&amp;gt; pacific.net.au&amp;gt; writes:&amp;gt; tom, I wonder if you could give us a sample of
&lt;br&gt;&amp;gt; using client side lo_creat , &amp;gt; insert &amp;nbsp;functions to insert a blob into postgres
&lt;br&gt;&amp;gt; - in an sql statement.
&lt;br&gt;&amp;gt; There's an example program in the docs:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/docs/8.4/static/lo-examplesect.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/docs/8.4/static/lo-examplesect.html&lt;/a&gt;&lt;br&gt;&amp;gt; regards, tom lane
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; Sent via pgsql-novice mailing list (p
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26550796&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gsql-novice@...&lt;/a&gt;)To make changes to your subscription:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26550796&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26550796.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26550638</id>
	<title>Re: bytea and text</title>
	<published>2009-11-27T21:30:10Z</published>
	<updated>2009-11-27T21:30:10Z</updated>
	<author>
		<name>Syan Tan-2</name>
	</author>
	<content type="html">Is there a gambas specific wrapper for the lo_export/lo_import function ? 
&lt;br&gt;&lt;br&gt;On Sat 28/11/09 01:29 , &amp;quot;Tom Lane&amp;quot; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26550638&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tgl@...&lt;/a&gt; sent:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; richard terry &amp;lt;rterry@
&lt;br&gt;&amp;gt; pacific.net.au&amp;gt; writes:&amp;gt; tom, I wonder if you could give us a sample of
&lt;br&gt;&amp;gt; using client side lo_creat , &amp;gt; insert &amp;nbsp;functions to insert a blob into postgres
&lt;br&gt;&amp;gt; - in an sql statement.
&lt;br&gt;&amp;gt; There's an example program in the docs:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/docs/8.4/static/lo-examplesect.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/docs/8.4/static/lo-examplesect.html&lt;/a&gt;&lt;br&gt;&amp;gt; regards, tom lane
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; Sent via pgsql-novice mailing list (p
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26550638&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gsql-novice@...&lt;/a&gt;)To make changes to your subscription:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26550638&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26550638.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26549752</id>
	<title>Re: bytea and text</title>
	<published>2009-11-27T17:29:52Z</published>
	<updated>2009-11-27T17:29:52Z</updated>
	<author>
		<name>Tom Lane-2</name>
	</author>
	<content type="html">richard terry &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26549752&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rterry@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; tom, I wonder if you could give us a sample of using client side lo_creat , 
&lt;br&gt;&amp;gt; insert &amp;nbsp;functions to insert a blob into postgres - in an sql statement.
&lt;br&gt;&lt;br&gt;There's an example program in the docs:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/docs/8.4/static/lo-examplesect.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/docs/8.4/static/lo-examplesect.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26549752&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26549752.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26549617</id>
	<title>Re: bytea and text</title>
	<published>2009-11-27T17:05:12Z</published>
	<updated>2009-11-27T17:05:12Z</updated>
	<author>
		<name>Syan Tan-2</name>
	</author>
	<content type="html">&lt;br&gt;this is a wrapper for one parameter 'base64' , I thought what he wanted was a simple
&lt;br&gt;way of uploading files by filename into a postgresql database field via a gambase
&lt;br&gt;client interface.
&lt;br&gt;&lt;br&gt;On Sat 28/11/09 00:08 , &amp;quot;Jean-Yves F. Barbier&amp;quot; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26549617&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;12ukwn@...&lt;/a&gt; sent:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; richard terry a écrit :
&lt;br&gt;&amp;gt; ...
&lt;br&gt;&amp;gt; &amp;gt; tom, I wonder if you could give us a sample of
&lt;br&gt;&amp;gt; using client side lo_creat , &amp;gt; insert &amp;nbsp;functions to insert a blob into postgres
&lt;br&gt;&amp;gt; - in an sql statement.&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; Despite reading the docs's I'm totally in the
&lt;br&gt;&amp;gt; dark and can't understand the &amp;gt; syntax.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Hi Richard, I modified the functions I sent you: they now store into
&lt;br&gt;&amp;gt; BINARY (BYTEA) format, not anymore into BASE64:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; CREATE OR REPLACE FUNCTION ucommon.testbytea_ins(Pstring TEXT) RETURNS oid
&lt;br&gt;&amp;gt; AS $$DECLARE
&lt;br&gt;&amp;gt; NewId &amp;nbsp; &amp;nbsp; &amp;nbsp;OID;
&lt;br&gt;&amp;gt; NewBytea &amp;nbsp; BYTEA;
&lt;br&gt;&amp;gt; BEGIN
&lt;br&gt;&amp;gt; NewBytea = decode(Pstring, 'base64');
&lt;br&gt;&amp;gt; INSERT INTO common.testbytea VALUES(default, NewBytea);
&lt;br&gt;&amp;gt; SELECT id INTO NewId FROM common.testbytea WHERE id = (SELECT
&lt;br&gt;&amp;gt; currval('testbytea_id_seq'));RETURN NewId;
&lt;br&gt;&amp;gt; END;
&lt;br&gt;&amp;gt; $$ LANGUAGE PLPGSQL STRICT SECURITY DEFINER;
&lt;br&gt;&amp;gt; REVOKE ALL ON FUNCTION ucommon.testbytea_ins(TEXT) FROM PUBLIC;
&lt;br&gt;&amp;gt; ---------------------------------------------------
&lt;br&gt;&amp;gt; CREATE OR REPLACE FUNCTION ucommon.testbytea_sel(Pid OID) RETURNS TEXT AS
&lt;br&gt;&amp;gt; $$DECLARE
&lt;br&gt;&amp;gt; MyPic &amp;nbsp; &amp;nbsp; &amp;nbsp; BYTEA;
&lt;br&gt;&amp;gt; MyString &amp;nbsp; &amp;nbsp;TEXT;
&lt;br&gt;&amp;gt; BEGIN
&lt;br&gt;&amp;gt; SELECT pic INTO MyPic FROM common.testbytea WHERE id = Pid;
&lt;br&gt;&amp;gt; MyString = encode(MyPic, 'base64');
&lt;br&gt;&amp;gt; RETURN MyString;
&lt;br&gt;&amp;gt; END;
&lt;br&gt;&amp;gt; $$ LANGUAGE PLPGSQL STRICT SECURITY DEFINER;
&lt;br&gt;&amp;gt; REVOKE ALL ON FUNCTION ucommon.testbytea_sel(OID) FROM PUBLIC;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; HIWH
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; JY
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; Objects in mirror may be closer than they appear.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; Sent via pgsql-novice mailing list (p
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26549617&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gsql-novice@...&lt;/a&gt;)To make changes to your subscription:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26549617&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26549617.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26549321</id>
	<title>Re: bytea and text</title>
	<published>2009-11-27T16:08:31Z</published>
	<updated>2009-11-27T16:08:31Z</updated>
	<author>
		<name>Jean-Yves F. Barbier-2</name>
	</author>
	<content type="html">richard terry a écrit :
&lt;br&gt;...
&lt;br&gt;&amp;gt; tom, I wonder if you could give us a sample of using client side lo_creat , 
&lt;br&gt;&amp;gt; insert &amp;nbsp;functions to insert a blob into postgres - in an sql statement.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Despite reading the docs's I'm totally in the dark and can't understand the 
&lt;br&gt;&amp;gt; syntax.
&lt;br&gt;&lt;br&gt;Hi Richard, I modified the functions I sent you: they now store into
&lt;br&gt;BINARY (BYTEA) format, not anymore into BASE64:
&lt;br&gt;&lt;br&gt;CREATE OR REPLACE FUNCTION ucommon.testbytea_ins(Pstring TEXT) RETURNS oid AS $$
&lt;br&gt;DECLARE
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NewId &amp;nbsp; &amp;nbsp; &amp;nbsp;OID;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NewBytea &amp;nbsp; BYTEA;
&lt;br&gt;BEGIN
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NewBytea = decode(Pstring, 'base64');
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INSERT INTO common.testbytea VALUES(default, NewBytea);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SELECT id INTO NewId FROM common.testbytea WHERE id = (SELECT currval('testbytea_id_seq'));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RETURN NewId;
&lt;br&gt;END;
&lt;br&gt;$$ LANGUAGE PLPGSQL STRICT SECURITY DEFINER;
&lt;br&gt;REVOKE ALL ON FUNCTION ucommon.testbytea_ins(TEXT) FROM PUBLIC;
&lt;br&gt;---------------------------------------------------
&lt;br&gt;CREATE OR REPLACE FUNCTION ucommon.testbytea_sel(Pid OID) RETURNS TEXT AS $$
&lt;br&gt;DECLARE
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyPic &amp;nbsp; &amp;nbsp; &amp;nbsp; BYTEA;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyString &amp;nbsp; &amp;nbsp;TEXT;
&lt;br&gt;BEGIN
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SELECT pic INTO MyPic FROM common.testbytea WHERE id = Pid;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyString = encode(MyPic, 'base64');
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RETURN MyString;
&lt;br&gt;END;
&lt;br&gt;$$ LANGUAGE PLPGSQL STRICT SECURITY DEFINER;
&lt;br&gt;REVOKE ALL ON FUNCTION ucommon.testbytea_sel(OID) FROM PUBLIC;
&lt;br&gt;&lt;br&gt;HIWH
&lt;br&gt;&lt;br&gt;JY
&lt;br&gt;-- 
&lt;br&gt;Objects in mirror may be closer than they appear.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26549321&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26549321.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26549276</id>
	<title>Re: bytea and text</title>
	<published>2009-11-27T16:00:06Z</published>
	<updated>2009-11-27T16:00:06Z</updated>
	<author>
		<name>Syan Tan-2</name>
	</author>
	<content type="html">Not sure if decode works for COPY statements though, I thought copy is faster
&lt;br&gt;than insert for bulk loading lots of data
&lt;br&gt;than using a client call in whatever language postgres driver. But then its only
&lt;br&gt;one field for binary data which is a lot bigger
&lt;br&gt;than the other fields in the tuple, so I'm not sure what is the rate-limiting
&lt;br&gt;factor here.
&lt;br&gt;&lt;br&gt;On Fri 27/11/09 14:18 , &amp;quot;Jean-Yves F. Barbier&amp;quot; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26549276&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;12ukwn@...&lt;/a&gt; sent:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Jasen Betts a écrit :
&lt;br&gt;&amp;gt; &amp;gt; On 2009-11-26, Jean-Yves F. Barbier &amp;lt;12ukwn@gmail
&lt;br&gt;&amp;gt; .com&amp;gt; wrote:&amp;gt;&amp;gt; Hi list,
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; I'm asking myself what solution for storing
&lt;br&gt;&amp;gt; pictures is the best:&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; * using a BYTEA column type, and having no
&lt;br&gt;&amp;gt; intrinsic compression gain &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;because a picture it almost every time
&lt;br&gt;&amp;gt; already compressed,&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; * using a TEXT column type, and store a
&lt;br&gt;&amp;gt; Base64(picture) in it; it should&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;take benefits of intrinsic compression
&lt;br&gt;&amp;gt; (?).&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; use bytea and convert to/from base64 if you
&lt;br&gt;&amp;gt; can't use the binary&amp;gt; interface and find the text interface
&lt;br&gt;&amp;gt; inconvenient.
&lt;br&gt;&amp;gt; that's what I do now
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; this will make the data over 1/3
&lt;br&gt;&amp;gt; bigger.
&lt;br&gt;&amp;gt; uuu, na: it comes as Base64 (to avoid a 0x89 unknown utf8 char error), but
&lt;br&gt;&amp;gt; itis converted to BYTEA as I now use decode('inparm', 'base64') before
&lt;br&gt;&amp;gt; insert,as back to Base64 when I extract it (with encode).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; * JHM wonders what Joey did to earn &amp;quot;I'd just like to say, for the
&lt;br&gt;&amp;gt; record,that Joey rules.&amp;quot;
&lt;br&gt;&amp;gt; -- Seen on #Debian
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; Sent via pgsql-novice mailing list (p
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26549276&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gsql-novice@...&lt;/a&gt;)To make changes to your subscription:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26549276&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26549276.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26549240</id>
	<title>Re: bytea and text</title>
	<published>2009-11-27T15:50:44Z</published>
	<updated>2009-11-27T15:50:44Z</updated>
	<author>
		<name>richard terry-5</name>
	</author>
	<content type="html">On Friday 27 November 2009 02:58:01 Tom Lane wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;quot;Jean-Yves F. Barbier&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26549240&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;12ukwn@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; &amp;gt; I'm asking myself what solution for storing pictures is the best:
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; * using a BYTEA column type, and having no intrinsic compression gain
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp; &amp;nbsp;because a picture it almost every time already compressed,
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; * using a TEXT column type, and store a Base64(picture) in it; it should
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp; &amp;nbsp;take benefits of intrinsic compression (?).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; At best, the compression would get rid of the overhead you added by
&lt;br&gt;&amp;gt; converting to base64. &amp;nbsp;It probably wouldn't completely succeed at that,
&lt;br&gt;&amp;gt; though, meaning the second alternative is always a loser.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 			regards, tom lane
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;tom, I wonder if you could give us a sample of using client side lo_creat , 
&lt;br&gt;insert &amp;nbsp;functions to insert a blob into postgres - in an sql statement.
&lt;br&gt;&lt;br&gt;Despite reading the docs's I'm totally in the dark and can't understand the 
&lt;br&gt;syntax.
&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;&lt;br&gt;richard (using gambas basic)
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26549240&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26549240.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26546614</id>
	<title>Extracting special case from a player table without union</title>
	<published>2009-11-27T11:05:15Z</published>
	<updated>2009-11-27T11:05:15Z</updated>
	<author>
		<name>Rikard Bosnjakovic-2</name>
	</author>
	<content type="html">I'm running a hockey player database and I'm building up statistics
&lt;br&gt;about player penalties. I extract the penalties like this:
&lt;br&gt;&lt;br&gt;SELECT P.playerid, T.number, count(P.playerid) AS num_penalties,
&lt;br&gt;sum(P.length) AS length_penalties
&lt;br&gt;FROM period_penalties P, troops T
&lt;br&gt;WHERE T.origin=1 AND T.season=2009 AND T.playerid=P.playerid AND NOT
&lt;br&gt;P.opponent AND P.period_id IN (...id_list...)
&lt;br&gt;GROUP BY P.playerid, T.number
&lt;br&gt;&lt;br&gt;and get a result like this:
&lt;br&gt;&lt;br&gt;&amp;nbsp;playerid | number | num_penalties | length_penalties
&lt;br&gt;----------+--------+---------------+------------------
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 236 | &amp;nbsp; &amp;nbsp; 89 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 26
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 267 | &amp;nbsp; &amp;nbsp; 20 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 37
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 214 | &amp;nbsp; &amp;nbsp; 14 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2
&lt;br&gt;...
&lt;br&gt;&lt;br&gt;This is what I want.
&lt;br&gt;&lt;br&gt;However, there is a special case which I need to fetch as well. The
&lt;br&gt;special case is lines in the table with playerid = 0, which means it's
&lt;br&gt;a team penalty instead of a player penalty. Id 0 does not exist in the
&lt;br&gt;player table (called &amp;quot;troops&amp;quot; in the query above), and that's why that
&lt;br&gt;row does not get included in the result.
&lt;br&gt;&lt;br&gt;The only way I found out how to include the special case row is by
&lt;br&gt;doing a union-query, like this:
&lt;br&gt;&lt;br&gt;SELECT ...as above...
&lt;br&gt;UNION
&lt;br&gt;SELECT P.playerid, Null, count(P.playerid) AS num_penalties,
&lt;br&gt;sum(P.length) AS length_penalties
&lt;br&gt;FROM period_penalties P
&lt;br&gt;WHERE playerid=0 AND NOT P.opponent AND P.period_id IN (...period_ids...)
&lt;br&gt;GROUP BY P.playerid
&lt;br&gt;ORDER BY length_penalties DESC, num_penalties DESC
&lt;br&gt;&lt;br&gt;and the result is like this:
&lt;br&gt;&lt;br&gt;&amp;nbsp;playerid | number | num_penalties | length_penalties
&lt;br&gt;----------+--------+---------------+------------------
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20 | &amp;nbsp; &amp;nbsp; &amp;nbsp;6 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;103
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;28 | &amp;nbsp; &amp;nbsp; &amp;nbsp;4 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;11 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 46
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 267 | &amp;nbsp; &amp;nbsp; 20 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 37
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 265 | &amp;nbsp; &amp;nbsp; &amp;nbsp;2 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 31
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 29
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 122 | &amp;nbsp; &amp;nbsp; 11 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 29
&lt;br&gt;...
&lt;br&gt;&lt;br&gt;Which is the actual result I want. However, I find the union-query
&lt;br&gt;horrible and in a way somewhat redundant. But since my JOIN-skills are
&lt;br&gt;too low I am unable to find a better solution than this.
&lt;br&gt;&lt;br&gt;If anyone can shed some light on how to approach this problem better
&lt;br&gt;than my solution I'm all ears.
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;- Rikard - &lt;a href=&quot;http://bos.hack.org/cv/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://bos.hack.org/cv/&lt;/a&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26546614&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Extracting-special-case-from-a-player-table-without-union-tp26546614p26546614.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26543794</id>
	<title>views</title>
	<published>2009-11-27T07:18:55Z</published>
	<updated>2009-11-27T07:18:55Z</updated>
	<author>
		<name>Jean-Yves F. Barbier-2</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;Knowing all fields can be selected, is there a difference making
&lt;br&gt;a view that references all fields one by one and a view with a &amp;quot;select *&amp;quot;?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;quot;I don't mind going nowhere as long as it's an interesting path.&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -- Ronald Mabbitt
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26543794&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/views-tp26543794p26543794.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26543757</id>
	<title>Re: How best to index foreign key for inner join</title>
	<published>2009-11-27T07:16:23Z</published>
	<updated>2009-11-27T07:16:23Z</updated>
	<author>
		<name>Thom Brown</name>
	</author>
	<content type="html">&lt;div class=&quot;gmail_quote&quot;&gt;2009/11/27 Nathaniel Trellice &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26543757&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;naptrel@...&lt;/a&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;

&lt;div bgcolor=&quot;#FFFFFF&quot;&gt;&lt;div class=&quot;im&quot;&gt;&lt;div&gt;On 27 Nov 2009, at 11:12, Thom Brown &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26543757&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;thombrown@...&lt;/a&gt;&amp;gt; wrote:&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;blockquote type=&quot;cite&quot;&gt;&lt;div&gt;Since for each row of table1 you&amp;#39;ll be looking for multiple records on table2, I imagine you&amp;#39;d want to index table2.table1_id, and table2.t since that&amp;#39;s what you&amp;#39;re filtering on.  If table1 is particularly big, you might benefit from also indexing &lt;a href=&quot;http://table1.name&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://table1.name&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;table1.name&lt;/a&gt;.&lt;br&gt;



&lt;br&gt;I personally prefer to use INNER JOIN syntax as it&amp;#39;s clearer, although the query planner will probably be identical as it&amp;#39;s clever that way:&lt;br&gt;&lt;br&gt;SELECT table2.x, table2.y, table2.t&lt;br&gt;FROM table1&lt;br&gt;INNER JOIN table2 ON &lt;a href=&quot;http://table1.id&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;table1.id&lt;/a&gt; = table2.table1_id&lt;br&gt;



AND &lt;a href=&quot;http://table1.name&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://table1.name&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;table1.name&lt;/a&gt; = &amp;#39;some_name&amp;#39;&lt;br&gt;WHERE table2.t BETWEEN some_t AND some_other_t;&lt;br&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thanks for the help Thom.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Do you think it&amp;#39;s possible to phrase this query in such a way that the planner would be able to exploit any benefits from a mutli-column index on table2 on either (table1_id, t) or (t, table1_t)?&lt;/div&gt;

&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;If you imagine setting up a view that encapsulates the inner join, creating a &amp;#39;virtual&amp;#39; table with columns:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;name text&lt;/div&gt;&lt;div class=&quot;im&quot;&gt;&lt;div&gt;x real&lt;/div&gt;&lt;div&gt;y real&lt;/div&gt;

&lt;div&gt;t timestampz&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Then the manual (11.3) suggests that ANDed queries on &amp;#39;name&amp;#39; and &amp;#39;t&amp;#39; will be improved by using a multi-column index (name, t).&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;But the join confuses me. When the rule system breaks down both the query and the view&amp;#39;s join, will the benefits of the multi-column index still be realised?&lt;/div&gt;

&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;font color=&quot;#888888&quot;&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Nathaniel&lt;/div&gt;&lt;br&gt;



      &lt;/font&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;Again, it really depends on the size of your tables.  If, for example, table2 contains 5 million rows and 99% of them have the same t value, and index probably won&amp;#39;t be used by the planner since it&amp;#39;s value distribution in the statistics data for that table (gathered by ANALYZE) would suggest a sequential scan is just as efficient.  If you have a lot of varying combinations between table2.table1_id and table2.t, a multi-column index will probably benefit you.&lt;br&gt;

&lt;br&gt;A good way to tell how much work is involved in running a query is to put EXPLAIN ANALYZE before it to see where the more expensive parts of the query are.&lt;br&gt;&lt;br&gt;There are many instances where indexes won&amp;#39;t be used by the planner purely because it&amp;#39;s statistics tell it that&amp;#39;s it&amp;#39;s more or equally efficient to a sequential scan.  You need to know your data well and take the size of the table into account.&lt;br&gt;

&lt;br&gt;I&amp;#39;m hoping someone with better query-planner knowledge can chime in here with more solid recommendations though.&lt;br&gt;&lt;br&gt;Thom&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-best-to-index-foreign-key-for-inner-join-tp26540904p26543757.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26543609</id>
	<title>Re: index speed-up and automatic tables/procedures creation</title>
	<published>2009-11-27T07:04:44Z</published>
	<updated>2009-11-27T07:04:44Z</updated>
	<author>
		<name>Jean-Yves F. Barbier-2</name>
	</author>
	<content type="html">Tom Lane a écrit :
&lt;br&gt;...
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I think you're wasting your time. &amp;nbsp;What you are setting out to do here
&lt;br&gt;&amp;gt; is manually emulate the top layer or so of a large index. &amp;nbsp;Unless you
&lt;br&gt;&amp;gt; have very specific (and unusual) data access patterns that you know in
&lt;br&gt;&amp;gt; considerable detail, this is not a game you are going to win. &amp;nbsp;Just go
&lt;br&gt;&amp;gt; with the one big table and one index, you'll be happier. &amp;nbsp;(Note that
&lt;br&gt;&amp;gt; &amp;quot;several million rows&amp;quot; is not big, it's barely enough to notice.)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You will see a lot of discussion about partitioning of tables if you
&lt;br&gt;&amp;gt; look around the list archives, but this is not done with the idea that
&lt;br&gt;&amp;gt; it makes access to any one row faster. &amp;nbsp;The biggest motivation usually
&lt;br&gt;&amp;gt; is to allow dropping ranges of data cheaply, like throwing away a month's
&lt;br&gt;&amp;gt; or year's worth of old data at once.
&lt;/div&gt;&lt;br&gt;Just to make sure I understood the spirit:
&lt;br&gt;&lt;br&gt;* I keep a large table,
&lt;br&gt;&lt;br&gt;* As my join tables have just (pkey=pkeys from each side), I also make indexes
&lt;br&gt;&amp;nbsp; &amp;nbsp;on each foreign pkey,
&lt;br&gt;&lt;br&gt;* (May be?) I also make partial indexes, in order to have ie a faster retrieve
&lt;br&gt;&amp;nbsp; &amp;nbsp;of not-sold items instead of excluding sold items in the query
&lt;br&gt;&lt;br&gt;JY
&lt;br&gt;-- 
&lt;br&gt;-- I have seen the FUN --
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26543609&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/index-speed-up-and-automatic-tables-procedures-creation-tp26535647p26543609.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26543350</id>
	<title>Re: How best to index foreign key for inner join</title>
	<published>2009-11-27T06:44:53Z</published>
	<updated>2009-11-27T06:44:53Z</updated>
	<author>
		<name>naptrel</name>
	</author>
	<content type="html">&lt;html&gt;&lt;body bgcolor=&quot;#FFFFFF&quot;&gt;&lt;div&gt;On 27 Nov 2009, at 11:12, Thom Brown &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26543350&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;thombrown@...&lt;/a&gt;&amp;gt; wrote:&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;blockquote type=&quot;cite&quot;&gt;&lt;div&gt;Since for each row of table1 you'll be looking for multiple records on table2, I imagine you'd want to index table2.table1_id, and table2.t since that's what you're filtering on.&amp;nbsp; If table1 is particularly big, you might benefit from also indexing &lt;a href=&quot;http://table1.name&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;&lt;a href=&quot;http://table1.name&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;table1.name&lt;/a&gt;&lt;/a&gt;.&lt;br&gt;

&lt;br&gt;I personally prefer to use INNER JOIN syntax as it's clearer, although the query planner will probably be identical as it's clever that way:&lt;br&gt;&lt;br&gt;SELECT table2.x, table2.y, table2.t&lt;br&gt;FROM table1&lt;br&gt;INNER JOIN table2 ON &lt;a href=&quot;http://table1.id&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;table1.id&lt;/a&gt; = table2.table1_id&lt;br&gt;

AND &lt;a href=&quot;http://table1.name&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;&lt;a href=&quot;http://table1.name&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;table1.name&lt;/a&gt;&lt;/a&gt; = 'some_name'&lt;br&gt;WHERE table2.t BETWEEN some_t AND some_other_t;&lt;br&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;div&gt;Thanks for the help Thom.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Do you think it's possible to phrase this query in such a way that the planner would be able to exploit any benefits from a mutli-column index on table2 on either (table1_id, t) or (t, table1_t)?&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;If you imagine setting up a view that encapsulates the inner join, creating a 'virtual' table with columns:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;name text&lt;/div&gt;&lt;div&gt;x real&lt;/div&gt;&lt;div&gt;y real&lt;/div&gt;&lt;div&gt;t timestampz&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Then the manual (11.3) suggests that ANDed queries on 'name' and 't' will be improved by using a multi-column index (name, t).&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;But the join confuses me. When the rule system breaks down both the query and the view's join, will the benefits of the multi-column index still be realised?&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Nathaniel&lt;/div&gt;&lt;br&gt;



      &lt;/body&gt;&lt;/html&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-best-to-index-foreign-key-for-inner-join-tp26540904p26543350.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26543048</id>
	<title>Re: index speed-up and automatic tables/procedures creation</title>
	<published>2009-11-27T06:21:03Z</published>
	<updated>2009-11-27T06:21:03Z</updated>
	<author>
		<name>Jean-Yves F. Barbier-2</name>
	</author>
	<content type="html">Tom Lane a écrit :
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;quot;Jean-Yves F. Barbier&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26543048&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;12ukwn@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt;&amp;gt; 1)- I'd like to keep a table in one piece, but it'll be huge (several millions rows
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; and growing); can a segmentation of indexes (all indexes that are used for 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; searching) speed-up this table scans enough to keep it as responsive to queries as 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; multiple tables? &amp;nbsp;And what can I do about the primary key index, which is monolitic?
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; (I can't use inheritance as there are some integrity references into it.)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I think you're wasting your time. &amp;nbsp;What you are setting out to do here
&lt;br&gt;&amp;gt; is manually emulate the top layer or so of a large index. &amp;nbsp;Unless you
&lt;br&gt;&amp;gt; have very specific (and unusual) data access patterns that you know in
&lt;br&gt;&amp;gt; considerable detail, this is not a game you are going to win. &amp;nbsp;Just go
&lt;br&gt;&amp;gt; with the one big table and one index, you'll be happier. &amp;nbsp;(Note that
&lt;br&gt;&amp;gt; &amp;quot;several million rows&amp;quot; is not big, it's barely enough to notice.)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You will see a lot of discussion about partitioning of tables if you
&lt;br&gt;&amp;gt; look around the list archives, but this is not done with the idea that
&lt;br&gt;&amp;gt; it makes access to any one row faster. &amp;nbsp;The biggest motivation usually
&lt;br&gt;&amp;gt; is to allow dropping ranges of data cheaply, like throwing away a month's
&lt;br&gt;&amp;gt; or year's worth of old data at once.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 			regards, tom lane
&lt;/div&gt;&lt;br&gt;That's a *very* clear answer, thanks Tom!
&lt;br&gt;&lt;br&gt;JY
&lt;br&gt;-- 
&lt;br&gt;If a thing's worth having, it's worth cheating for.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -- W. C. Fields
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26543048&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/index-speed-up-and-automatic-tables-procedures-creation-tp26535647p26543048.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26543014</id>
	<title>Re: bytea and text</title>
	<published>2009-11-27T06:18:54Z</published>
	<updated>2009-11-27T06:18:54Z</updated>
	<author>
		<name>Jean-Yves F. Barbier-2</name>
	</author>
	<content type="html">Jasen Betts a écrit :
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On 2009-11-26, Jean-Yves F. Barbier &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26543014&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;12ukwn@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hi list,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I'm asking myself what solution for storing pictures is the best:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; * using a BYTEA column type, and having no intrinsic compression gain 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;because a picture it almost every time already compressed,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; * using a TEXT column type, and store a Base64(picture) in it; it should
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;take benefits of intrinsic compression (?).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; use bytea and convert to/from base64 if you can't use the binary
&lt;br&gt;&amp;gt; interface and find the text interface inconvenient.
&lt;/div&gt;&lt;br&gt;that's what I do now
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;gt; this will make the data over 1/3 bigger.
&lt;br&gt;&lt;br&gt;uuu, na: it comes as Base64 (to avoid a 0x89 unknown utf8 char error), but it
&lt;br&gt;is converted to BYTEA as I now use decode('inparm', 'base64') before insert,
&lt;br&gt;as back to Base64 when I extract it (with encode).
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;* JHM wonders what Joey did to earn &amp;quot;I'd just like to say, for the record,
&lt;br&gt;&amp;nbsp; that Joey rules.&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -- Seen on #Debian
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26543014&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26543014.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26541008</id>
	<title>Re: How best to index foreign key for inner join</title>
	<published>2009-11-27T03:12:09Z</published>
	<updated>2009-11-27T03:12:09Z</updated>
	<author>
		<name>Thom Brown</name>
	</author>
	<content type="html">&lt;div class=&quot;gmail_quote&quot;&gt;2009/11/27 Nathaniel Trellice &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26541008&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;naptrel@...&lt;/a&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;

Hello,&lt;br&gt;
&lt;br&gt;
I&amp;#39;d appreciate advice anyone can offer on this simple, newbie&lt;br&gt;
question. It really is a straightforward question, so please bare with&lt;br&gt;
me if I don&amp;#39;t explain it succinctly below.&lt;br&gt;
&lt;br&gt;
I want to search a table based on criteria on both a column within&lt;br&gt;
that table and a column within a joined table, and I&amp;#39;m trying to&lt;br&gt;
figure out how to index things for my particular form of query. The&lt;br&gt;
postgres manual is excellent, but it doesn&amp;#39;t appear to answer this&lt;br&gt;
question explicitly through a matching example, and I&amp;#39;m not very good&lt;br&gt;
with indexing, so I&amp;#39;m seeking advice here (yet again).&lt;br&gt;
&lt;br&gt;
E.g. Suppose I have 2 tables defined:&lt;br&gt;
&lt;br&gt;
CREATE TABLE table1 (&lt;br&gt;
  id      SERIAL PRIMARY KEY,&lt;br&gt;
  name    text&lt;br&gt;
);&lt;br&gt;
&lt;br&gt;
CREATE TABLE table2 (&lt;br&gt;
  x            real,&lt;br&gt;
  y            real,&lt;br&gt;
  t            timestampz,&lt;br&gt;
  table1_id    integer REFERENCES table1 ON DELETE CASCADE&lt;br&gt;
);&lt;br&gt;
&lt;br&gt;
My queries upon these tables are, almost exclusively, asking for all&lt;br&gt;
the records with a particular &amp;#39;name&amp;#39; between a range of times &amp;#39;t&amp;#39;, and&lt;br&gt;
so are of the form:&lt;br&gt;
&lt;br&gt;
SELECT table2.x, table2.y, table2.t&lt;br&gt;
FROM table2, table1&lt;br&gt;
WHERE&lt;br&gt;
  table2.table1_id = &lt;a href=&quot;http://table1.id&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;table1.id&lt;/a&gt;    -- inner join&lt;br&gt;
  AND &lt;a href=&quot;http://table1.name&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;table1.name&lt;/a&gt; = &amp;#39;some_name&amp;#39;    -- criterion on table1&lt;br&gt;
  AND table2.t BETWEEN some_t AND some_other_t;    --criterion on table2&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
What columns should I index in table2, and how: multi-column on&lt;br&gt;
(table1_id, t), say, or multiple single column indexes, or only one&lt;br&gt;
on &amp;#39;t&amp;#39;?&lt;br&gt;
&lt;br&gt;
I guess the query might benefit from an index on table1&amp;#39;s &amp;#39;name&amp;#39;&lt;br&gt;
column, but since there are, typically, only tens or hundreds of&lt;br&gt;
records in table1, it might not be worth it. There are millions of&lt;br&gt;
records in table2.&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
Nathaniel&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;&lt;/font&gt;&lt;br&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;Since for each row of table1 you&amp;#39;ll be looking for multiple records on table2, I imagine you&amp;#39;d want to index table2.table1_id, and table2.t since that&amp;#39;s what you&amp;#39;re filtering on.  If table1 is particularly big, you might benefit from also indexing &lt;a href=&quot;http://table1.name&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;table1.name&lt;/a&gt;.&lt;br&gt;

&lt;br&gt;I personally prefer to use INNER JOIN syntax as it&amp;#39;s clearer, although the query planner will probably be identical as it&amp;#39;s clever that way:&lt;br&gt;&lt;br&gt;SELECT table2.x, table2.y, table2.t&lt;br&gt;FROM table1&lt;br&gt;INNER JOIN table2 ON &lt;a href=&quot;http://table1.id&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;table1.id&lt;/a&gt; = table2.table1_id&lt;br&gt;

AND &lt;a href=&quot;http://table1.name&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;table1.name&lt;/a&gt; = &amp;#39;some_name&amp;#39;&lt;br&gt;WHERE table2.t BETWEEN some_t AND some_other_t;&lt;br&gt;&lt;br&gt;Regards&lt;br&gt;&lt;br&gt;Thom&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-best-to-index-foreign-key-for-inner-join-tp26540904p26541008.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26540904</id>
	<title>How best to index foreign key for inner join</title>
	<published>2009-11-27T03:04:21Z</published>
	<updated>2009-11-27T03:04:21Z</updated>
	<author>
		<name>naptrel</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;I'd appreciate advice anyone can offer on this simple, newbie
&lt;br&gt;question. It really is a straightforward question, so please bare with
&lt;br&gt;me if I don't explain it succinctly below.
&lt;br&gt;&lt;br&gt;I want to search a table based on criteria on both a column within
&lt;br&gt;that table and a column within a joined table, and I'm trying to
&lt;br&gt;figure out how to index things for my particular form of query. The
&lt;br&gt;postgres manual is excellent, but it doesn't appear to answer this
&lt;br&gt;question explicitly through a matching example, and I'm not very good
&lt;br&gt;with indexing, so I'm seeking advice here (yet again).
&lt;br&gt;&lt;br&gt;E.g. Suppose I have 2 tables defined:
&lt;br&gt;&lt;br&gt;CREATE TABLE table1 (
&lt;br&gt;&amp;nbsp; id &amp;nbsp; &amp;nbsp; &amp;nbsp;SERIAL PRIMARY KEY,
&lt;br&gt;&amp;nbsp; name &amp;nbsp; &amp;nbsp;text
&lt;br&gt;);
&lt;br&gt;&lt;br&gt;CREATE TABLE table2 (
&lt;br&gt;&amp;nbsp; x &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;real,
&lt;br&gt;&amp;nbsp; y &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;real,
&lt;br&gt;&amp;nbsp; t &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;timestampz,
&lt;br&gt;&amp;nbsp; table1_id &amp;nbsp; &amp;nbsp;integer REFERENCES table1 ON DELETE CASCADE
&lt;br&gt;);
&lt;br&gt;&lt;br&gt;My queries upon these tables are, almost exclusively, asking for all
&lt;br&gt;the records with a particular 'name' between a range of times 't', and
&lt;br&gt;so are of the form:
&lt;br&gt;&lt;br&gt;SELECT table2.x, table2.y, table2.t
&lt;br&gt;FROM table2, table1
&lt;br&gt;WHERE
&lt;br&gt;&amp;nbsp; table2.table1_id = table1.id &amp;nbsp; &amp;nbsp;-- inner join
&lt;br&gt;&amp;nbsp; AND table1.name = 'some_name' &amp;nbsp; &amp;nbsp;-- criterion on table1
&lt;br&gt;&amp;nbsp; AND table2.t BETWEEN some_t AND some_other_t; &amp;nbsp; &amp;nbsp;--criterion on table2
&lt;br&gt;&lt;br&gt;&lt;br&gt;What columns should I index in table2, and how: multi-column on
&lt;br&gt;(table1_id, t), say, or multiple single column indexes, or only one
&lt;br&gt;on 't'?
&lt;br&gt;&lt;br&gt;I guess the query might benefit from an index on table1's 'name'
&lt;br&gt;column, but since there are, typically, only tens or hundreds of
&lt;br&gt;records in table1, it might not be worth it. There are millions of
&lt;br&gt;records in table2.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;Nathaniel
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26540904&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-best-to-index-foreign-key-for-inner-join-tp26540904p26540904.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26538976</id>
	<title>Re: bytea and text</title>
	<published>2009-11-26T23:57:18Z</published>
	<updated>2009-11-26T23:57:18Z</updated>
	<author>
		<name>Jasen Betts-5</name>
	</author>
	<content type="html">On 2009-11-26, Jean-Yves F. Barbier &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26538976&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;12ukwn@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Hi list,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I'm asking myself what solution for storing pictures is the best:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; * using a BYTEA column type, and having no intrinsic compression gain 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;because a picture it almost every time already compressed,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; * using a TEXT column type, and store a Base64(picture) in it; it should
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;take benefits of intrinsic compression (?).
&lt;br&gt;&lt;br&gt;use bytea and convert to/from base64 if you can't use the binary
&lt;br&gt;interface and find the text interface inconvenient.
&lt;br&gt;&lt;br&gt;this will make the data over 1/3 bigger.
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26538976&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/bytea-and-text-tp26530411p26538976.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26538489</id>
	<title>Re: index speed-up and automatic tables/procedures creation</title>
	<published>2009-11-26T22:49:39Z</published>
	<updated>2009-11-26T22:49:39Z</updated>
	<author>
		<name>Tom Lane-2</name>
	</author>
	<content type="html">&amp;quot;Jean-Yves F. Barbier&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26538489&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;12ukwn@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&amp;gt; 1)- I'd like to keep a table in one piece, but it'll be huge (several millions rows
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; and growing); can a segmentation of indexes (all indexes that are used for 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; searching) speed-up this table scans enough to keep it as responsive to queries as 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; multiple tables? &amp;nbsp;And what can I do about the primary key index, which is monolitic?
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; (I can't use inheritance as there are some integrity references into it.)
&lt;br&gt;&lt;br&gt;I think you're wasting your time. &amp;nbsp;What you are setting out to do here
&lt;br&gt;is manually emulate the top layer or so of a large index. &amp;nbsp;Unless you
&lt;br&gt;have very specific (and unusual) data access patterns that you know in
&lt;br&gt;considerable detail, this is not a game you are going to win. &amp;nbsp;Just go
&lt;br&gt;with the one big table and one index, you'll be happier. &amp;nbsp;(Note that
&lt;br&gt;&amp;quot;several million rows&amp;quot; is not big, it's barely enough to notice.)
&lt;br&gt;&lt;br&gt;You will see a lot of discussion about partitioning of tables if you
&lt;br&gt;look around the list archives, but this is not done with the idea that
&lt;br&gt;it makes access to any one row faster. &amp;nbsp;The biggest motivation usually
&lt;br&gt;is to allow dropping ranges of data cheaply, like throwing away a month's
&lt;br&gt;or year's worth of old data at once.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; regards, tom lane
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26538489&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/index-speed-up-and-automatic-tables-procedures-creation-tp26535647p26538489.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26537921</id>
	<title>Re: index speed-up and automatic tables/procedures creation</title>
	<published>2009-11-26T20:47:17Z</published>
	<updated>2009-11-26T20:47:17Z</updated>
	<author>
		<name>Jean-Yves F. Barbier-2</name>
	</author>
	<content type="html">Greg Stark a écrit :
&lt;br&gt;&amp;gt; On Fri, Nov 27, 2009 at 3:15 AM, Jean-Yves F. Barbier &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26537921&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;12ukwn@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; Sooo, I guess the answer is: cut your table by pieces=year?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Well there's no one-size-fits-all solution. It'll depend on your
&lt;br&gt;&amp;gt; priorities and your situation.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;br&gt;Ok, this one will be the items' table, as there can be many types of
&lt;br&gt;links between an item and different documents, links will be done
&lt;br&gt;by tables containing item(id),doc(id) - one for each type of doc.
&lt;br&gt;&lt;br&gt;May be, I'm not sure at the moment, when items will be out of warranty
&lt;br&gt;and/or documents won't need to be legally kept online, I'll move
&lt;br&gt;them to itema (for Archive) - and the same for docs.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Very few profundities can be expressed in less than 80 characters.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26537921&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/index-speed-up-and-automatic-tables-procedures-creation-tp26535647p26537921.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26537697</id>
	<title>Re: index speed-up and automatic tables/procedures creation</title>
	<published>2009-11-26T19:58:22Z</published>
	<updated>2009-11-26T19:58:22Z</updated>
	<author>
		<name>Greg Stark-5</name>
	</author>
	<content type="html">On Fri, Nov 27, 2009 at 3:15 AM, Jean-Yves F. Barbier &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26537697&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;12ukwn@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Sooo, I guess the answer is: cut your table by pieces=year?
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;Well there's no one-size-fits-all solution. It'll depend on your
&lt;br&gt;priorities and your situation.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;greg
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26537697&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/index-speed-up-and-automatic-tables-procedures-creation-tp26535647p26537697.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26537481</id>
	<title>Re: index speed-up and automatic tables/procedures creation</title>
	<published>2009-11-26T19:15:44Z</published>
	<updated>2009-11-26T19:15:44Z</updated>
	<author>
		<name>Jean-Yves F. Barbier-2</name>
	</author>
	<content type="html">Greg Stark a écrit :
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Thu, Nov 26, 2009 at 10:19 PM, Jean-Yves F. Barbier &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26537481&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;12ukwn@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; 1)- I'd like to keep a table in one piece, but it'll be huge (several millions rows
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;and growing); can a segmentation of indexes (all indexes that are used for
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;searching) speed-up this table scans enough to keep it as responsive to queries as
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;multiple tables? &amp;nbsp;And what can I do about the primary key index, which is monolitic?
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;(I can't use inheritance as there are some integrity references into it.)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; There are plenty of people with tables with many more than several
&lt;br&gt;&amp;gt; million records. How big that is depends on how wide those rows are,
&lt;br&gt;&amp;gt; but still, it's not necessarily a problem. Indexed access speed should
&lt;br&gt;&amp;gt; scale fine.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The real problem that partitioning addresses is routine maintenance.
&lt;br&gt;&amp;gt; When it comes time to dump this table or create a new index or even
&lt;br&gt;&amp;gt; just scan a large section of the table for a report you may find the
&lt;br&gt;&amp;gt; jobs taking impracticably long.
&lt;/div&gt;&amp;nbsp;
&lt;br&gt;Sooo, I guess the answer is: cut your table by pieces=year?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;lt;Overfiend&amp;gt; ltd: Fine, go through life just pointing and grunting at
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; what you mean. &amp;nbsp;Works for Mac users.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26537481&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/index-speed-up-and-automatic-tables-procedures-creation-tp26535647p26537481.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26536412</id>
	<title>Re: index speed-up and automatic tables/procedures creation</title>
	<published>2009-11-26T16:04:01Z</published>
	<updated>2009-11-26T16:04:01Z</updated>
	<author>
		<name>Greg Stark-5</name>
	</author>
	<content type="html">On Thu, Nov 26, 2009 at 10:19 PM, Jean-Yves F. Barbier &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26536412&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;12ukwn@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; 1)- I'd like to keep a table in one piece, but it'll be huge (several millions rows
&lt;br&gt;&amp;gt;    and growing); can a segmentation of indexes (all indexes that are used for
&lt;br&gt;&amp;gt;    searching) speed-up this table scans enough to keep it as responsive to queries as
&lt;br&gt;&amp;gt;    multiple tables?  And what can I do about the primary key index, which is monolitic?
&lt;br&gt;&amp;gt;    (I can't use inheritance as there are some integrity references into it.)
&lt;br&gt;&lt;br&gt;There are plenty of people with tables with many more than several
&lt;br&gt;million records. How big that is depends on how wide those rows are,
&lt;br&gt;but still, it's not necessarily a problem. Indexed access speed should
&lt;br&gt;scale fine.
&lt;br&gt;&lt;br&gt;The real problem that partitioning addresses is routine maintenance.
&lt;br&gt;When it comes time to dump this table or create a new index or even
&lt;br&gt;just scan a large section of the table for a report you may find the
&lt;br&gt;jobs taking impracticably long.
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;greg
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-novice mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26536412&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-novice@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-novice&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-novice&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/index-speed-up-and-automatic-tables-procedures-creation-tp26535647p26536412.html" />
</entry>

</feed>
