Re: [GENERAL] Lengthy deletion

2011-11-29 Thread Herouth Maoz
On 29/11/2011, at 09:13, Tom Lane wrote: > "Herouth Maoz" writes: >> I was instructed to delete old records from one of the tables in our >> production system. The deletion took hours and I had to stop it in >> mid-operation and reschedule it as a night job. But then I had to do the >> same w

Re: [GENERAL] Lengthy deletion

2011-11-29 Thread Tom Lane
Herouth Maoz writes: > On 29/11/2011, at 09:13, Tom Lane wrote: >> Yup, that's a clue all right. I'll bet a nickel that you don't >> have an index on the foreign key's referencing column (ie, >> sent_messages.subscription_id). That means each delete in >> the referenced table has to seqscan the

Re: [GENERAL] odbc_fdw

2011-11-29 Thread Albe Laurenz
fschwend at hsr.ch wrote: > I built the current PostgreSQL 9.1.1 sources under Ubuntu 11.04 (in a VMware under Win7). > I followed the steps in this guide: > www.thegeekstuff.com/2009/04/linux-postgresql-install-and-configure-from -source > > It seems to work (I can run the server and connect to i

Re: [GENERAL] psql query gets stuck indefinitely

2011-11-29 Thread tamanna madaan
well, one question : Is tcp-keep-alive enabled by default in postgres-8.1.2 . I am using postgres on linux platform . On Tue, Nov 29, 2011 at 8:51 AM, tamanna madaan < tamanna.mad...@globallogic.com> wrote: > Hi Craig > > Thanks for your reply . But unfortunately I dont have that process runni

[GENERAL] Re: Any experiences with Foreign Data Wrappers (FDW) like mysql_fdw, odbc_fdw, www_fdw or odbc_fdw?

2011-11-29 Thread Ronan Dunklau
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello. We use (and develop) the multicorn foreign data wrapper (http://multicorn.org). It is very experimental, but works well for our needs. We use it to perform IMAP searches in our in-house CRM solution, as well as to list files on a file system.

[GENERAL] immutable functions

2011-11-29 Thread Andy Chambers
The documentation has this to say about immutable functions... > or otherwise use information not directly present in its argument list If the arguments are "row variables", does this allow access to the data in the row? For example, is it safe to make the following function definition immutable

[GENERAL] Limiting number of connections to PostgreSQL per IP (not per DB/user)?

2011-11-29 Thread Heiko Wundram
Hello! Sorry for that subscribe post I've just sent, that was bad reading on my part (for the subscribe info on the homepage). Anyway, the title says it all: is there any possibility to limit the number of connections that a client can have concurrently with a PostgreSQL-Server with "on-boar

[GENERAL] PLPGSQL: How can I get the effected rows when use "execute" command in function

2011-11-29 Thread Muiz
Dear all, Can I get the effected rows after executing sqls in function? e.g.: CREATE OR REPLACE FUNCTION execsqls(sqls character varying) RETURNS integer AS $BODY$ DECLARE BEGIN EXECUTE sqls; -- TODO-1: I want to know how many records the input sqls effects?

Re: [GENERAL] PLPGSQL: How can I get the effected rows when use "execute" command in function

2011-11-29 Thread Pavel Stehule
Hello yes, you can. Look on GET DIAGNOSTICS statement http://www.postgresql.org/docs/9.1/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS Regards Pavel Stehule 2011/11/29 Muiz : > Dear all, > >    Can I get the effected rows after executing sqls in function? > e.g.: > > CREAT

Re: [GENERAL] PLPGSQL: How can I get the effected rows when use "execute" command in function

2011-11-29 Thread Ernesto Quiniones
if you are doing insert, update or delete you can use "retuirng" command in the query, work with a cursor to get the rows - Mensaje original - > Dear all, > >      Can I get the effected rows after executing sqls in function? > e.g.: > > CREATE OR REPLACE FUNCTION execsqls(sqls charac

[GENERAL] initdb failure on Windows 2003

2011-11-29 Thread Mike Wylde
I’m trying to install Postgres 8.4.9.1 on a Windows 2003 SP2 64bit operating system. The download has installed previously (to a windows 7 box) so I know it should be OK but under W2003 the initdb command seems to be failing. It doesn’t return an error message but non of the actions are performed,

Re: [GENERAL] immutable functions

2011-11-29 Thread Tom Lane
Andy Chambers writes: > The documentation has this to say about immutable functions... >> or otherwise use information not directly present in its argument list > If the arguments are "row variables", does this allow access to the > data in the row? Sure. regards, tom la

[GENERAL] Sporadic query not returning anything..how to diagnose?

2011-11-29 Thread Phoenix Kiula
Hi. (My pgbouncer is finally working and has results in at least a 3-fold site speed increase! YAY! Thanks to everyone who helped.) Now, a new small problem. In my PHP code I have a condition that checks for the existence of a record, and if not found, it INSERTs a new one. Here's the first SQL

Re: [GENERAL] Sporadic query not returning anything..how to diagnose?

2011-11-29 Thread Heiko Wundram
Am 29.11.2011 16:46, schrieb Phoenix Kiula: About 5% of the times (in situations of high traffic), this is not returning a value in my PHP code. Because it's not found, the code tries to INSERT a new record and there's a duplicate key error, which is in the logs. The traffic to the site is much h

Re: [GENERAL] stored function data structures - difficulty

2011-11-29 Thread J.V.
1) What is "a1" ? 2) Where did the queries below come from? 3) What information does each query below provide? On 11/21/2011 9:14 PM, Pavel Stehule wrote: Hello 2011/11/22 J.V.: I cannot find a way to programatically: 1. Given a table name, find all foreign key fields in the given table

Re: [GENERAL] stored function data structures - difficulty

2011-11-29 Thread Pavel Stehule
Hello 2011/11/29 J.V. : > 1) > What is "a1" ? a1 is table name > > 2) > Where did the queries below come from? > These queries are used in "psql" console to ensure run backslash commands > 3) > What information does each query below provide? columns names, column types and other Regards Pavel

[GENERAL] Query Optimizer makes a poor choice

2011-11-29 Thread Tyler Hains
Hi, We’ve got a strange situation where two queries get dramatically different performance because of how the Query Optimizer handles LIMIT. # explain analyze select * from cards where card_set_id=2850 order by card_id; QUERY

Re: [GENERAL] Query Optimizer makes a poor choice

2011-11-29 Thread Filip Rembiałkowski
2011/11/29 Tyler Hains : > # explain analyze select * from cards where card_set_id=2850 order by > card_id limit 1; >    QUERY PLAN > -

Re: [GENERAL] initdb failure on Windows 2003

2011-11-29 Thread Filip Rembiałkowski
what is the output when you run this in command line: ...\path\to\initdb.exe c:\testpgdata ? 2011/11/29 Mike Wylde : > I’m trying to install Postgres 8.4.9.1 on a Windows 2003 SP2 64bit operating > system. The download has installed previously (to a windows 7 box) so I know > it should be OK b

Re: [GENERAL] Extending the volume size of the data directory volume

2011-11-29 Thread Filip Rembiałkowski
here's what I would do to analyze this first: - vmstat 1 - iostat -k -x 3 - look into system logs, maybe something actually happened there... - look at the process list. find if some of Pg processes are in D state - strace -f -v 2011/11/29 panam : > Hi, > > as I am importing gigabytes of d

Re: [GENERAL] Query Optimizer makes a poor choice

2011-11-29 Thread Scott Marlowe
On Tue, Nov 29, 2011 at 11:21 AM, Tyler Hains wrote: > # explain analyze select * from cards where card_set_id=2850 order by > card_id limit 1; >    QUERY PLAN >

[GENERAL] DDL & DML Logging doesn't work for calling functions

2011-11-29 Thread MURAT KOÇ
Hi list, Version is PostgreSQL 9.0.4 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51), 64-bit. We set logging parameters as below for DDL & DML Logging: logging_collector = on log_statement = mod log_line_prefix = '%t--%d--%u--%h--%a--%i--%e' Server log f

Re: [GENERAL] Query Optimizer makes a poor choice

2011-11-29 Thread Tyler Hains
2011/11/29 Tyler Hains : > # explain analyze select * from cards where card_set_id=2850 order by > card_id limit 1; >    QUERY PLAN > --

Re: [GENERAL] Query Optimizer makes a poor choice

2011-11-29 Thread Tyler Hains
On Tue, Nov 29, 2011 at 11:21 AM, Tyler Hains wrote: > # explain analyze select * from cards where card_set_id=2850 order by > card_id limit 1; >    QUERY PLAN >

Re: [GENERAL] Query Optimizer makes a poor choice

2011-11-29 Thread Filip Rembiałkowski
2011/11/29 Tyler Hains : > I haven't had a chance to experiment with the SET STATISTICS, but that > got me going on something interesting... > > Do these statistics look right? > > # SELECT attname, n_distinct, most_common_vals, histogram_bounds FROM > pg_stats WHERE tablename = 'cards'; > ... >

Re: [GENERAL] Limiting number of connections to PostgreSQL per IP (not per DB/user)?

2011-11-29 Thread Heiko Wundram
Am 29.11.2011 20:44, schrieb Filip Rembiałkowski: no easy, "standard" way of doing this in postgres. before we go into workarounds - what's the underlying OS? Okay, that's too bad that there's no standard way for this. The underlying OS is Linux (Gentoo, to be exact), and I'd already thought

Re: [GENERAL] Query Optimizer makes a poor choice

2011-11-29 Thread Tomas Vondra
Hi, what PostgreSQL version is this? That's the first thing we need to know. On 29.11.2011 22:28, Tyler Hains wrote: > Yes, I'm pretty sure autovacuum is enabled. Changing the query as shown > there uses the sub-optimal index. That doesn't mean > I haven't had a chance to experiment with the S

Re: [GENERAL] Query Optimizer makes a poor choice

2011-11-29 Thread Tomas Vondra
On 29.11.2011 21:34, Scott Marlowe wrote: > On Tue, Nov 29, 2011 at 11:21 AM, Tyler Hains > wrote: >> # explain analyze select * from cards where card_set_id=2850 order by >> card_id limit 1; >>QUERY PLAN >> -

Re: [GENERAL] Limiting number of connections to PostgreSQL per IP (not per DB/user)?

2011-11-29 Thread Filip Rembiałkowski
W dniu 29 listopada 2011 23:18 użytkownik Heiko Wundram napisał: > Okay, that's too bad that there's no standard way for this. The underlying > OS is Linux (Gentoo, to be exact), and I'd already thought about setting up > some form of iptables firewalling, but there's no real framework for this >

Re: [GENERAL] Limiting number of connections to PostgreSQL per IP (not per DB/user)?

2011-11-29 Thread Tom Lane
=?UTF-8?Q?Filip_Rembia=C5=82kowski?= writes: > W dniu 29 listopada 2011 23:18 użytkownik Heiko Wundram > napisał: >> Okay, that's too bad that there's no standard way for this. > did you look at connlimit? > http://www.netfilter.org/projects/patch-o-matic/pom-external.html#pom-external-connlim

Re: [GENERAL] Query Optimizer makes a poor choice

2011-11-29 Thread Tomas Vondra
On 29.11.2011 23:06, Filip Rembiałkowski wrote: > 2011/11/29 Tyler Hains : > > >> I haven't had a chance to experiment with the SET STATISTICS, but that >> got me going on something interesting... >> >> Do these statistics look right? >> >> # SELECT attname, n_distinct, most_common_vals, histogra

Re: [GENERAL] Query Optimizer makes a poor choice

2011-11-29 Thread Tomas Vondra
On 29.11.2011 22:43, Tyler Hains wrote: > There are actually more like 27 million rows in the table. That's why it > really should be filtering the rows using the index on the other column > before ordering for the limit. Well, the problem is that the PostgreSQL MVCC model is based on keeping co

Re: [GENERAL] Query Optimizer makes a poor choice

2011-11-29 Thread Tomas Vondra
On 29.11.2011 23:19, Tomas Vondra wrote: > Hi, > > what PostgreSQL version is this? That's the first thing we need to know. > > On 29.11.2011 22:28, Tyler Hains wrote: >> Yes, I'm pretty sure autovacuum is enabled. Changing the query as shown >> there uses the sub-optimal index. > > That doesn'

Re: [GENERAL] Extending the volume size of the data directory volume

2011-11-29 Thread panam
Hi Filip, Thanks for the suggestions. There is no indication of disk activity triggered by postgres. iostat reports: Cannot find disk data (maybe because the system is hosted in a OpenVZ environment?) Systemlogs (syslog and postgresql-9.1-main.log) do not indicate something unusual. All pg threads

Re: [GENERAL] Extending the volume size of the data directory volume

2011-11-29 Thread Scott Marlowe
On Tue, Nov 29, 2011 at 6:32 PM, panam wrote: > Hi Filip, > > Thanks for the suggestions. > There is no indication of disk activity triggered by postgres. > iostat reports: Cannot find disk data (maybe because the system is hosted in > a OpenVZ environment?) > Systemlogs (syslog and postgresql-9.1

Re: [GENERAL] Extending the volume size of the data directory volume

2011-11-29 Thread Craig Ringer
On 11/30/2011 09:32 AM, panam wrote: Hi Filip, Thanks for the suggestions. There is no indication of disk activity triggered by postgres. iostat reports: Cannot find disk data (maybe because the system is hosted in a OpenVZ environment?) Systemlogs (syslog and postgresql-9.1-main.log) do not ind

Re: [GENERAL] Extending the volume size of the data directory volume

2011-11-29 Thread panam
Hi, output is -- View this message in context: http://postgresql.1045698.n5.nabble.com/Extending-the-volume-size-of-the-data-directory-volume-tp5030663p5034494.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@pos

Re: [GENERAL] Extending the volume size of the data directory volume

2011-11-29 Thread panam
No, but will try this first, thanks for the suggestion. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Extending-the-volume-size-of-the-data-directory-volume-tp5030663p5034495.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql

Re: [GENERAL] tricking EXPLAIN?

2011-11-29 Thread Shigeru Hanada
(2011/11/28 20:55), Wim Bertels wrote: > If we look at the output of EXPLAIN ANALYZE, > then according to the COST the second query is best one, > but according to the ACTUAL TIME the first query is best > (which seems logical intuitively). > > So explain is being tricked, > and the reason for thi