Re: [GENERAL] new databases using a template.

2011-03-07 Thread Guillaume Lelarge
Le 01/03/2011 07:42, Malm Paul a écrit : Hi, I'm trying to create a new database by using a template database. But it is not possible. The error code is that some one is using the template, but no one is using it. I would bet *you* are connected with pgadmin to the template1 database. I'm

Re: [GENERAL] pg_dump slow with bytea data

2011-03-07 Thread chris r.
Merlin, first of all, thanks for your reply! hm. where exactly is all this time getting spent? Are you i/o bound? cpu bound? Is there any compression going on? Very good questions. pg_dump -F c compresses per default at a moderate level (manpage), whatever compression level 'moderate'

[GENERAL] PG and dynamic statements in stored procedures/triggers?

2011-03-07 Thread Durumdara
Hi! In other RDBMS I found a way to make dynamic statements. I can use variables, or concat the SQL segments, and execute it all. :tablename = call CreateTempTable; insert into :tablename drop table :tablename or (FireBird like cursor handling): sql = select * from || :tablename ||

Re: [GENERAL] PG and dynamic statements in stored procedures/triggers?

2011-03-07 Thread Vibhor Kumar
On Mar 7, 2011, at 8:02 PM, Durumdara wrote: Hi! In other RDBMS I found a way to make dynamic statements. I can use variables, or concat the SQL segments, and execute it all. :tablename = call CreateTempTable; insert into :tablename drop table :tablename or (FireBird like

Re: [GENERAL] PG and dynamic statements in stored procedures/triggers?

2011-03-07 Thread Adrian Klaver
On Monday, March 07, 2011 6:32:44 am Durumdara wrote: Hi! In other RDBMS I found a way to make dynamic statements. I can use variables, or concat the SQL segments, and execute it all. :tablename = call CreateTempTable; insert into :tablename drop table :tablename or (FireBird

Re: [GENERAL] PG and dynamic statements in stored procedures/triggers?

2011-03-07 Thread Durumdara
Hi! Thanks! How do I create cursor or for select in PGSQL with dynamic way? For example :tbl = GenTempTableName() insert into :tbl... insert into :tbl... insert into :tbl... for select :part_id from :tbl begin exec 'select count(*) from subitems where id = ?' using :part_id into :sumof

Re: [GENERAL] pg_dump slow with bytea data

2011-03-07 Thread Merlin Moncure
On Mon, Mar 7, 2011 at 7:28 AM, chris r. chri...@gmx.net wrote: Merlin, first of all, thanks for your reply! hm.  where exactly is all this time getting spent?  Are you i/o bound? cpu bound? Is there any compression going on? Very good questions. pg_dump -F c compresses per default at a

Re: [GENERAL] PG and dynamic statements in stored procedures/triggers?

2011-03-07 Thread Adrian Klaver
On Monday, March 07, 2011 6:45:11 am Durumdara wrote: Hi! Thanks! How do I create cursor or for select in PGSQL with dynamic way? For example :tbl = GenTempTableName() insert into :tbl... insert into :tbl... insert into :tbl... for select :part_id from :tbl begin exec

[GENERAL] Logic AND between some strings

2011-03-07 Thread yagru_alvarez
I want to make a Logic AND between some strings of 0s and 1s .. Here you have an example: 1- 01100010 2- 1100 I wanto to make a LOGIC AND between 01100010 and 1100. I' m working with C++, I need some code to have an idea about how I can perform that. -- Sent via pgsql-general mailing

Re: [GENERAL] Web Hosting

2011-03-07 Thread matty jones
Thanks for the thoughts everyone. I am looking at rimuhosting right now. I looked at godaddy and while they do allow me to install stuff and there prices are very reasonable, I am a firm believer in you get what you pay for. I think it would be better for me to spend 30-40 a month then 5-10 a

[GENERAL] Logic AND between some strings

2011-03-07 Thread yagru_alvarez
I want to make a Logic AND between some strings of 0s and 1s .. Here you have an example: 1- 01100010 2- 1100 I wanto to make a LOGIC AND between 01100010 and 1100. I' m working with C++, I need some code to have an idea about how I can perform that. -- Sent via pgsql-general mailing

[GENERAL] Logic AND between some strings

2011-03-07 Thread yagru_alvarez
I want to make a Logic AND between some STRINGS of 0s and 1s .. Here you have an example: 1- 01100010 2- 1100 I want to make a LOGIC AND between 01100010 and 1100. I' m working with C++, I need some code to have an idea about how I can perform that. -- Sent via pgsql-general mailing

Re: [GENERAL] Web Hosting

2011-03-07 Thread Ogden
On Mar 6, 2011, at 2:11 AM, Brent Wood wrote: Rimu hosting allows you to install whatever you want, including Postgres... which I have done before now. If your project is in support of Open Source software in any way, ask what discount they can offer, they have been pretty generous in

Re: [GENERAL] pg_dump slow with bytea data

2011-03-07 Thread Merlin Moncure
On Mon, Mar 7, 2011 at 8:52 AM, Merlin Moncure mmonc...@gmail.com wrote: Well, that's a pretty telling case, although I'd venture to say not typical.  In average databases, I'd expect 10-50% range of improvement going from text-binary which is often not enough to justify the compatibility

Re: [GENERAL] Logic AND between some strings

2011-03-07 Thread Vick Khera
On Mon, Mar 7, 2011 at 10:14 AM, yagru_alvarez jmalva...@estudiantes.uci.cu wrote: I wanto to make a LOGIC AND between 01100010 and 1100. I' m working with C++, I need some code to have an idea about how I can perform that. You want to do this in C++ or in SQL? In SQL it looks like

[GENERAL] First production install - general advice

2011-03-07 Thread runner
I'm going to go live with my first production install of PostgreSQL 9.0 in about a week. I've done a LOT of reading on the internet and I've purchased two very good reference books and actually read them: PostgreSQL 9 Administration Cookbook PostgreSQL 9.0 High Performance I'd like to

Re: [GENERAL] First production install - general advice

2011-03-07 Thread Ray Stell
On Mon, Mar 07, 2011 at 12:34:19PM -0500, runner wrote: I'd like to know if any of you have ever installed a PostgreSQL database for production use and then found something you wish you had done differently after the fact. Test and document your disaster recovery plan. You don't want

[GENERAL] Understanding of LOCK and pg_sleep interaction

2011-03-07 Thread David Johnston
Hi, In trying to setup a test for a LOCK 'table' algorithm I attempt to execute two transactions where the first one issues a pg_sleep(10) while 'table' is locked and the second one attempts LOCK 'table' during the time when the pg_sleep is executing. When pg_sleep() returns in the first

Re: [GENERAL] Web Hosting

2011-03-07 Thread Benjamin Smith
Try this: http://lmgtfy.com/?q=web+hosting+postgresql On Sunday, March 06, 2011 11:33:01 am Eduardo wrote: At 17:24 06/03/2011, you wrote: On 3/5/2011 4:08 PM, matty jones wrote: I already have a domain name but I am looking for a hosting company that I can use PG with. The few I have

Re: [GENERAL] Web Hosting

2011-03-07 Thread Matt
Thanks, but I tried that originally and the companies that come up have either poor ratings, won't support postgres, won't allow me the freedom to run my own software, or after talking with them I realized there was PEBKAC issues with there support staff. I also, as stated earlier, won't go with

Re: [GENERAL] Why count(*) doest use index?

2011-03-07 Thread Merlin Moncure
On Sun, Mar 6, 2011 at 2:57 PM, Glenn Maynard gl...@zewt.org wrote: On Sun, Mar 6, 2011 at 5:41 AM, Martijn van Oosterhout klep...@svana.org wrote: If it's really really important there are ways you can use trigger tables and summary views to achieve the results you want. Except it's

Re: [GENERAL] Understanding of LOCK and pg_sleep interaction

2011-03-07 Thread Tom Lane
David Johnston pol...@yahoo.com writes: In trying to setup a test for a LOCK 'table' algorithm I attempt to execute two transactions where the first one issues a pg_sleep(10) while 'table' is locked and the second one attempts LOCK 'table' during the time when the pg_sleep is executing. When

[GENERAL] unexpected EOF on client connection vs 9.0.3

2011-03-07 Thread Piotr Czekalski
Hello there, I'm getting regular Postgres log entries with the following error: 2011-03-07 01:00:01 CET LOG: could not receive data from client: No connection could be made because the target machine actively refused it. 2011-03-07 01:00:01 CET LOG: unexpected EOF on client connection They

Re: [GENERAL] Understanding of LOCK and pg_sleep interaction

2011-03-07 Thread David Johnston
OK, so I try the same scripts with pgAdminIII and they work as expected. Sorry for the noise. David J. -Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: Monday, March 07, 2011 1:20 PM To: David Johnston Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL]

Re: [GENERAL] Logic AND between some strings

2011-03-07 Thread Bill Thoen
Just to make sure, you're asking for the logical AND, not the bitwise AND? In other words you're not talking about getting into bit shifting with and and masking with ? For the logical AND, you need to use expressions that evaluate to TRUE or FALSE, and follow the rules in this truth table:

Re: [GENERAL] Why count(*) doest use index?

2011-03-07 Thread Scott Marlowe
On Sun, Mar 6, 2011 at 3:41 AM, Martijn van Oosterhout klep...@svana.org wrote: The other option is visibility data in the index. Doubles the size of your indexes though. Also requires both table and index be locked while you update both so you don't get race conditions. so has a real

Re: [GENERAL] Web Hosting

2011-03-07 Thread Aleksey Tsalolikhin
On Sat, Mar 5, 2011 at 5:12 PM, Ogden li...@darkstatic.com wrote: On Mar 5, 2011, at 7:07 PM, Bret Fledderjohn wrote:  I am using A2 Hosting (www.a2hosting.com ) which offers 8.4...  They are inexpensive and so far reliable. Wow, that's super cheap. Is there some catch - $5.57 / month for

Re: [GENERAL] Why count(*) doest use index?

2011-03-07 Thread Glenn Maynard
On Mon, Mar 7, 2011 at 1:13 PM, Merlin Moncure mmonc...@gmail.com wrote: On Sun, Mar 6, 2011 at 2:57 PM, Glenn Maynard gl...@zewt.org wrote: That's often perfectly fine, with read-heavy, single-writer workloads. I definitely wish there was a way to create indexes to track counters on

Re: [GENERAL] PG and dynamic statements in stored procedures/triggers?

2011-03-07 Thread Bill Thoen
On 3/7/2011 7:55 AM, Adrian Klaver wrote: On Monday, March 07, 2011 6:45:11 am Durumdara wrote: Hi! Thanks! How do I create cursor or for select in PGSQL with dynamic way? For example :tbl = GenTempTableName() insert into :tbl... insert into :tbl... insert into :tbl... for select :part_id

Re: [GENERAL] Why count(*) doest use index?

2011-03-07 Thread Merlin Moncure
On Mon, Mar 7, 2011 at 3:16 PM, Glenn Maynard gl...@zewt.org wrote: On Mon, Mar 7, 2011 at 1:13 PM, Merlin Moncure mmonc...@gmail.com wrote: On Sun, Mar 6, 2011 at 2:57 PM, Glenn Maynard gl...@zewt.org wrote: That's often perfectly fine, with read-heavy, single-writer workloads. I

Re: [GENERAL] Why count(*) doest use index?

2011-03-07 Thread Dmitriy Igrishin
2011/3/8 Merlin Moncure mmonc...@gmail.com On Mon, Mar 7, 2011 at 3:16 PM, Glenn Maynard gl...@zewt.org wrote: On Mon, Mar 7, 2011 at 1:13 PM, Merlin Moncure mmonc...@gmail.com wrote: On Sun, Mar 6, 2011 at 2:57 PM, Glenn Maynard gl...@zewt.org wrote: That's often perfectly fine, with

Re: [GENERAL] PG and dynamic statements in stored procedures/triggers?

2011-03-07 Thread Adrian Klaver
On Monday, March 07, 2011 1:16:11 pm Bill Thoen wrote: For example, I have a need for a tool that gets an initial record id from the user, then it looks up that key and finds the primary keys of two other tables related to the firstkey, then it looks those tables up and displays the data

Re: [GENERAL] PG and dynamic statements in stored procedures/triggers?

2011-03-07 Thread Merlin Moncure
On Mon, Mar 7, 2011 at 3:16 PM, Bill Thoen bth...@gisnet.com wrote: On 3/7/2011 7:55 AM, Adrian Klaver wrote: On Monday, March 07, 2011 6:45:11 am Durumdara wrote: Hi! Thanks! How do I create cursor or for select in PGSQL with dynamic way? For example :tbl = GenTempTableName()

Re: [GENERAL] First production install - general advice

2011-03-07 Thread Michael Black
One thing that comes to mind... Have you tested the install process from start to end? Other than that, a week until to go live is a is time to relax, exhale, prop your feet on the desk, and visualize the process thinking of every step, automated and manual, what could happen here and is a

Re: [GENERAL] Why count(*) doest use index?

2011-03-07 Thread Glenn Maynard
On Mon, Mar 7, 2011 at 4:35 PM, Merlin Moncure mmonc...@gmail.com wrote: SELECT COUNT(*) FROM table WHERE expr; will use index (assuming expr is optimizable and is worth while to optimize). Your case might be interesting for cache purposes if expr2 is expensive, but has nothing to do with

Re: [GENERAL] database is bigger after dump/restore - why? (60 GB to 109 GB)

2011-03-07 Thread Aleksey Tsalolikhin
On Fri, Mar 4, 2011 at 7:19 PM, Adrian Klaver adrian.kla...@gmail.com wrote: On Friday, March 04, 2011 5:11:04 pm Aleksey Tsalolikhin wrote: On Fri, Mar 4, 2011 at 4:45 PM, Adrian Klaver adrian.kla...@gmail.com wrote: On Friday, March 04, 2011 2:03:23 pm Aleksey Tsalolikhin wrote: On Fri,

Re: [GENERAL] Why count(*) doest use index?

2011-03-07 Thread Merlin Moncure
On Mon, Mar 7, 2011 at 4:26 PM, Glenn Maynard gl...@zewt.org wrote: On Mon, Mar 7, 2011 at 4:35 PM, Merlin Moncure mmonc...@gmail.com wrote: SELECT COUNT(*) FROM table WHERE expr; will use index (assuming expr is optimizable and is worth while to optimize).  Your case might be interesting

[GENERAL] Create unique index or constraint on part of a column

2011-03-07 Thread Ruben Blanco
Hi: Is there anyway to create a unique index or constraint on part of a column? Something like this, but something that works ;-) ALTER TABLE invoices ADD CONSTRAINT cons UNIQUE (EXTRACT(YEAR FROM invoice_date), innvoice_number); Thanks for any help. Ruben,

Re: [GENERAL] Create unique index or constraint on part of a column

2011-03-07 Thread Thomas Kellerer
Ruben Blanco wrote on 08.03.2011 00:30: Hi: Is there anyway to create a unique index or constraint on part of a column? Something like this, but something that works ;-) ALTER TABLE invoices ADD CONSTRAINT cons UNIQUE (EXTRACT(YEAR FROM invoice_date), innvoice_number); Thanks for any

Re: [GENERAL] Why count(*) doest use index?

2011-03-07 Thread Glenn Maynard
On Mon, Mar 7, 2011 at 5:58 PM, Merlin Moncure mmonc...@gmail.com wrote: SELECT COUNT(*), event_time::date FROM events WHERE event_time::date = '2011-01-01' AND event_time::date '2011-02-01' AND user=50 GROUP BY event_time::date; select count(*) from events where (user,

Re: [GENERAL] Create unique index or constraint on part of a column

2011-03-07 Thread Jeff Davis
On Mon, 2011-03-07 at 23:30 +, Ruben Blanco wrote: Hi: Is there anyway to create a unique index or constraint on part of a column? Something like this, but something that works ;-) ALTER TABLE invoices ADD CONSTRAINT cons UNIQUE (EXTRACT(YEAR FROM invoice_date),

Re: [GENERAL] database is bigger after dump/restore - why? (60 GB to 109 GB)

2011-03-07 Thread Adrian Klaver
On Monday, March 07, 2011 2:45:00 pm Aleksey Tsalolikhin wrote: Experiment 1: hypothesis: something about how large my table has grown is causing the TOAST compression to fail on COPY. test: pg_dump the big table, cut the dump file in half using /bin/split, add \. at the end of the file,

Re: [GENERAL] unexpected EOF on client connection vs 9.0.3

2011-03-07 Thread Craig Ringer
On 08/03/11 02:49, Piotr Czekalski wrote: I've checked and verified that all connections are closed within the code, what's more, the problem has appeared just as I've moved server from Fedora Linux x86_64 running Postgres 8.4.2 to the Windows and 9.0.3 (details above) thus I conclude this is

[GENERAL] How to tune this query

2011-03-07 Thread Adarsh Sharma
Dear all, Can anyone Please guide me with some suggestions on how to tune the below query as I needed to perform the below query as faster as i can. I have 3 tables on which the query runs: pdc_uima=# select pg_size_pretty(pg_total_relation_size('page_content_demo')); pg_size_pretty

Re: [GENERAL] How to tune this query

2011-03-07 Thread Jaiswal Dhaval Sudhirkumar
In query some are the repeatative information like below value repeating 3 times. 19.548124415111626 73.21900819489186 You can create the spatial index on spatial data which will improve the performance of the query off course ANALYZE after creating index. -- Thanks Regards Dhaval