[GENERAL] select statment going slow and slow while using IN (xx,xx)

2012-01-12 Thread Yan Chunlu
I am transforming a db with millions records to anther schema. for some reason I need to select the records using IN (xx,xx). the ids in the IN was about 1000 recored every time, but I found the query was getting slow while the selection moving on. the shared buffer is 2048M. and the cpu and i

Re: [GENERAL] select statment going slow and slow while using IN (xx,xx)

2012-01-12 Thread Yan Chunlu
I also tried explain but found nothing special: explain select * from data_table where thing_id in (164438,112478,102941,112377,164442,181764,104028); QUERY PLAN --

[GENERAL] Re: [GENERAL] Problemas ao salvar endereços de rede.

2012-01-12 Thread Fabrízio de Royes Mello
Em 11 de janeiro de 2012 18:29, giuliano.medina escreveu: > Bom dia pessoal, > > Estou passando por um problema semelhante, mas com duas versões de base de > dados diferentes. > > Se eu rodar, na versão 'PostgreSQL 8.4.4, compiled by Visual C++ build > 1400, > 32-bit', o comando: > insert into esc

[GENERAL] Pgsql problem

2012-01-12 Thread pasman pasmański
Hi. I write function in pgsql. This function needs to execute other functions by name. I do it using loop: declare r record; begin for r in execute 'select ' || $1 || '()' loop end loop; But I can't convert a record to array of text. How to do it ? pasman -- Sent via pgsql-g

Re: [GENERAL] Pgsql problem

2012-01-12 Thread Dmitriy Igrishin
Hey pasman, 2012/1/12 pasman pasmański > Hi. > > I write function in pgsql. This function needs > to execute other functions by name. > I do it using loop: > > declare r record; > begin > for r in execute 'select ' || $1 || '()' > loop > end loop; > > But I can't convert a record to array of t

[GENERAL] unnest array of row type

2012-01-12 Thread seiliki
Hi! CREATE TYPE my_row_type AS (c1 SMALLINT,c2 TEXT); CREATE FUNCTION tmp_get_c1(my_row_type) RETURNS SMALLINT AS 'SELECT $1.c1' LANGUAGE SQL; CREATE FUNCTION tmp_get_c2(my_row_type) RETURNS TEXT AS 'SELECT $1.c2' LANGUAGE SQL; CREATE TABLE test (c1 SMALLINT,c2 TEXT,c3 TEXT); INSERT INTO tes

Re: [GENERAL] unnest array of row type

2012-01-12 Thread Pavel Stehule
2012/1/12 : > Hi! > > CREATE TYPE my_row_type AS (c1 SMALLINT,c2 TEXT); > > CREATE FUNCTION tmp_get_c1(my_row_type) RETURNS SMALLINT AS 'SELECT $1.c1' > LANGUAGE SQL; > > CREATE FUNCTION tmp_get_c2(my_row_type) RETURNS TEXT AS 'SELECT $1.c2' > LANGUAGE SQL; > > CREATE TABLE test (c1 SMALLINT,c2

Re: [GENERAL] unnest array of row type

2012-01-12 Thread Merlin Moncure
On Thu, Jan 12, 2012 at 8:47 AM, Pavel Stehule wrote: > 2012/1/12  : >> Hi! >> >> CREATE TYPE my_row_type AS (c1 SMALLINT,c2 TEXT); >> >> CREATE FUNCTION tmp_get_c1(my_row_type) RETURNS SMALLINT AS 'SELECT $1.c1' >> LANGUAGE SQL; >> >> CREATE FUNCTION tmp_get_c2(my_row_type) RETURNS TEXT AS 'SELE

Re: [GENERAL] unnest array of row type

2012-01-12 Thread Pavel Stehule
2012/1/12 Merlin Moncure : > On Thu, Jan 12, 2012 at 8:47 AM, Pavel Stehule > wrote: >> 2012/1/12  : >>> Hi! >>> >>> CREATE TYPE my_row_type AS (c1 SMALLINT,c2 TEXT); >>> >>> CREATE FUNCTION tmp_get_c1(my_row_type) RETURNS SMALLINT AS 'SELECT $1.c1' >>> LANGUAGE SQL; >>> >>> CREATE FUNCTION tmp_

Re: [GENERAL] Compiling C function with VC++ for Windows version

2012-01-12 Thread Edwin Quijada
Date: Thu, 12 Jan 2012 13:45:06 +0800 From: ring...@ringerc.id.au To: listas_quij...@hotmail.com CC: pgsql-general@postgresql.org Subject: Re: [GENERAL] Compiling C function with VC++ for Windows version On 12/01/12 11:06, Edwin Quijada wrote: Hi

Re: [GENERAL] PG synchronous replication and unresponsive slave

2012-01-12 Thread Manoj Govindassamy
any help on this is much appreciated. thanks, Manoj On 01/11/2012 01:50 PM, Manoj Govindassamy wrote: Hi, I have a PG 9.1.2 Master <--> Slave with synchronous replication setup. They are all working fine as expected. I do have a case where I want to flip Master to non replication mode when

Re: [GENERAL] indexes no longer used after shutdown during reindexing

2012-01-12 Thread Matt Dew
On 01/11/2012 04:29 PM, Tom Lane wrote: Matt Dew writes: I have a database that was shut down, cleanly, during an 'reindex table' command. When the database came back up, queries against that table started doing sequential scans instead of using the indexes as they had been up until that

Re: [GENERAL] indexes no longer used after shutdown during reindexing

2012-01-12 Thread Tom Lane
Matt Dew writes: > On 01/11/2012 04:29 PM, Tom Lane wrote: >> What exactly is your definition of a "clean shutdown"? > Is a reboot command considered a clean shutdown? It's a redhat box > which called /etc/init.d/postgresql stop, which does: pg_ctl stop -D > '$PGDATA' -s -m fast Well, a fast

Re: [GENERAL] Enumeration of tables is very slow in largish database

2012-01-12 Thread Kirill Müller
On 01/12/2012 02:02 AM, Tom Lane wrote: There were fixes for that in 8.4.9, so I'd be interested to know if you get a better estimate in a more up-to-date version. Something weird happened today. The problem vanished into thin air. Plus we got our server upgrade to 8.4.9, but definitely after

Re: [GENERAL] Enumeration of tables is very slow in largish database

2012-01-12 Thread Tom Lane
=?ISO-8859-1?Q?Kirill_M=FCller?= writes: > On 01/12/2012 02:02 AM, Tom Lane wrote: >> There were fixes for that in 8.4.9, so I'd be interested to know if you >> get a better estimate in a more up-to-date version. > Something weird happened today. The problem vanished into thin air. Plus > we got

[GENERAL] Experiences with Trigram Matching

2012-01-12 Thread Jonathan Bartlett
I blogged about my experiences with using PG 9.1's trigram indexes, and thought some here might be interested: http://bartlettpublishing.com/site/bartpub/blog/3/entry/350 I would appreciate any feedback anyone has. Jon

[GENERAL] Experiences using Trigram Matching

2012-01-12 Thread Jonathan Bartlett
I blogged about my experiences with using PG 9.1's trigram indexes, and thought some here might be interested: http://bartlettpublishing.com/site/bartpub/blog/3/entry/350 I would appreciate any feedback anyone has. Jon

[GENERAL] Operator based on data type

2012-01-12 Thread Daniel McGreal
Good day! I started off writing a question to this list, but in so doing I thought of a solution! :) So, I'll try and record the result, in case anyone else finds themselves in this unfortunate situation or has suggestions for improvements (especially any regarding query performance). My system g

[GENERAL] Corrupted index, what do i do?

2012-01-12 Thread eshishki
Hello, today i restarted my postgresql 9.0 instance and it won't start. The logs are 2012-01-12 14:01:59.976 MSK,,,5644,,4f0eaf97.160c,2,,2012-01-12 14:01:59 MSK,,0,LOG,0,"database system was not properly shut down; automatic recovery in progress","" 2012-01-12 14:01:59.976 MSK,,,5644

Re: [GENERAL] Pgsql problem

2012-01-12 Thread Achilleas Mantzios
On Πεμ 12 Ιαν 2012 12:51:00 pasman pasmański wrote: > Hi. > > I write function in pgsql. This function needs > to execute other functions by name. > I do it using loop: > > declare r record; > begin > for r in execute 'select ' || $1 || '()' > loop > end loop; > > But I can't convert a recor

[GENERAL] Postgresql allow connections without password

2012-01-12 Thread debian nick
I have postgresql 8.4.9 installed now, my problem is that from time to time my postgresql let psql version 8.4.9 access the database without asking for password (psql -d mydatabase -h myhost -U myuser), and the connection attempts from psql 8.3 are not allowed no matter what i got time out exceptio

Re: [GENERAL] Postgresql allow connections without password

2012-01-12 Thread Adrian Klaver
On Wednesday, January 11, 2012 9:16:04 pm debian nick wrote: > I have postgresql 8.4.9 installed now, my problem is that from time to time > my postgresql let psql version 8.4.9 access the database without asking for > password (psql -d mydatabase -h myhost -U myuser), and the connection > attempts

Re: [GENERAL] Postgresql allow connections without password

2012-01-12 Thread Alan Hodgson
On Thursday, January 12, 2012 02:16:04 AM debian nick wrote: > Any help will be really appreciate. Check your pg_hba.conf file for any entries with "trust" or "ident". Remove them and restart the server. Also look for .pgpass files in the home directories of any user seeing this. -- Sent via p

[GENERAL] Operator based on data type

2012-01-12 Thread Daniel McGreal
Good day! I started off writing a question to this list, but in so doing I thought of a solution! :) So, I'll try and record the result, in case anyone else finds themselves in this unfortunate situation or has suggestions for improvements (especially any regarding query performance). My system g

[GENERAL] ownership of sequences by tables in pg_dumps?

2012-01-12 Thread Andrew Hammond
Where foo is a number of different tables, I'm calling pg_dump --format=custom --compress=9 --no-password --file=public.foo.pgdump --table=public.foo --schema-only my_database When I check the contents of that dump using pg_restore -l public.foo.pgdump in some cases it includes the foo_id_seq o

Re: [GENERAL] ownership of sequences by tables in pg_dumps?

2012-01-12 Thread Adrian Klaver
On Thursday, January 12, 2012 6:53:03 pm Andrew Hammond wrote: > Where foo is a number of different tables, I'm calling > > pg_dump --format=custom --compress=9 --no-password > --file=public.foo.pgdump --table=public.foo --schema-only my_database > > When I check the contents of that dump using >

Re: [GENERAL] Corrupted index, what do i do?ruc

2012-01-12 Thread Craig Ringer
On 12/01/2012 9:08 PM, eshishki wrote: 14:01:59 MSK,,0,FATAL,XX002,"index ""1339592"" contains unexpected zero page at block 328134",,"Please REINDEX it.",,,"" 2012-01-12 14:02:00.042 MSK,,,5642,,4f0eaf97.160a,1,,2012-01-12 14:01:59 MSK,,0,LOG,0,"startup process (PID 5644) exited with exi

Re: [GENERAL] Operator based on data type

2012-01-12 Thread Craig Ringer
On 12/01/2012 9:20 PM, Daniel McGreal wrote: I have ended up writing a function (more accurately, two functions) which always convert a value into an array, either by returning the array immediately or by nesting it inside one so that all queries can use the second form, above. CREATE OR REPL

Re: [GENERAL] Compiling C function with VC++ for Windows version

2012-01-12 Thread Craig Ringer
On 13/01/2012 1:55 AM, Edwin Quijada wrote: Ok. This is the way that I compile. Linux this way works fine and I use the modules compiled. of course, Linux I compile from source and I use gcc. Yep... but Windows isn't Linux. In particular, the distributions of PostgreSQL for Windows are compi