Re: [GENERAL] Constraint exclusion and overlapping range checks

2013-09-06 Thread Steve Atkins
On Sep 6, 2013, at 9:37 PM, François Beausoleil wrote: > > Le 2013-09-07 à 00:29, Steve Atkins a écrit : > >> If I have a partitioned table that has some range constraints that look >> kinda like they're intended for constraint exclusion, but aren't quite >> non-overlapping, will that break

Re: [GENERAL] Constraint exclusion and overlapping range checks

2013-09-06 Thread François Beausoleil
Le 2013-09-07 à 00:29, Steve Atkins a écrit : > If I have a partitioned table that has some range constraints that look kinda > like they're intended for constraint exclusion, but aren't quite > non-overlapping, will that break anything? > > e.g. > > create table jan ( …, check(created >= '2

[GENERAL] Constraint exclusion and overlapping range checks

2013-09-06 Thread Steve Atkins
If I have a partitioned table that has some range constraints that look kinda like they're intended for constraint exclusion, but aren't quite non-overlapping, will that break anything? e.g. create table jan ( …, check(created >= '2013-01-01' and created < '2013-02-01'), check(id >=0 and id

Re: [GENERAL] select DISTINCT

2013-09-06 Thread Jeff Janes
On Friday, September 6, 2013, pg noob wrote: > > Hi all, > > I'm curious about some of the query estimates that I'm seeing with queries > that use DISTINCT. > I am using postgres 8.4.13 > > I did a couple of quick tests, and found that PostgreSQL seems to do some > expensive work to > return DISTI

Re: [GENERAL] Call for design: PostgreSQL mugs

2013-09-06 Thread Peter Geoghegan
On Thu, Sep 5, 2013 at 8:22 AM, Merlin Moncure wrote: > I'm still partial to this guy: > > http://www.commandprompt.com/images/mammoth_versus_dolphin_500.jpg I dislike that image, and always have. Apart from risking alienating people, I think it sends the wrong message - that we define ourselves

Re: [GENERAL] select DISTINCT

2013-09-06 Thread Kevin Grittner
pg noob wrote: > The GROUP BY performs much better than DISTINCT even though both > these two queries return the exact same count result. No, GROUP BY performs much better than count(DISTINCT colname). To confirm that this isn't something that has changed in the four years since 8.4 was release

Re: [GENERAL] Call for design: PostgreSQL mugs

2013-09-06 Thread Berend Tober
Peter Geoghegan wrote: On Thu, Sep 5, 2013 at 8:22 AM, Merlin Moncure wrote: I'm still partial to this guy: http://www.commandprompt.com/images/mammoth_versus_dolphin_500.jpg I dislike that image, and always have. ... I agree with Mr. Geoghegan. That image should be eradicated from the p

Re: [GENERAL] SQL Path in psql

2013-09-06 Thread Rob Sargentg
On 09/06/2013 11:05 AM, miles wrote: Bobby Dewitt wrote I come from an Oracle background and I am fairly new to Postgres. Oracle's command line utility (SQL*Plus) uses an environment variable called SQLPATH to search the given directories for SQL scripts that the user calls to execute using a me

Re: [GENERAL] SQL Path in psql

2013-09-06 Thread David Johnston
lup wrote >> >> > I wonder if this would at least get the full path on-screen for a c/p > \! for d in $SQLPATH; do find $d -name > > ; done > > That said, I would down-vote this suggestion. I tend to put sql files > in amongst my various project dirs and maintaining the envvar isn't > w

[GENERAL] select DISTINCT

2013-09-06 Thread pg noob
Hi all, I'm curious about some of the query estimates that I'm seeing with queries that use DISTINCT. I am using postgres 8.4.13 I did a couple of quick tests, and found that PostgreSQL seems to do some expensive work to return DISTINCT rows. This is contrary to what I was expecting because I ex

Re: [GENERAL] SQL Path in psql

2013-09-06 Thread David Kerr
On Fri, Sep 06, 2013 at 10:45:26AM -0700, David Johnston wrote: - lup wrote - >> - >> - > I wonder if this would at least get the full path on-screen for a c/p - > \! for d in $SQLPATH; do find $d -name - > - > ; done - > - > That said, I would down-vote this suggestion. I tend to put sql

Re: [GENERAL] SQL Path in psql

2013-09-06 Thread Miles Pomeroy
In my opinion, the use of such a feature is to make simple, commonly used scripts available from wherever you start up psql and no matter what database you are connecting to. On Oracle/SQL*Plus I have used this feature to create simple scripts that replicate informational backslash commands in psql

Re: [GENERAL] Levenshtein Distance with more than 255 characters

2013-09-06 Thread John R Pierce
On 9/6/2013 2:00 PM, jane...@web.de wrote: Where can I change levensthein_max_length? as the message you quoted said, its #define MAX_LEVENSHTEIN_STRLEN I'd expect this (without bothering to look) to be in a .h file in the fuzzystrmatch contributed module directory. -- john r p

Re: [GENERAL] Levenshtein Distance with more than 255 characters

2013-09-06 Thread janek12
Where can I change levensthein_max_length? Janek Sendrowski Von: "Szymon Guz" An: "Tom Lane" Betreff: Re: [GENERAL] Levenshtein Distance with more than 255 characters On 6 September 2013 08:47, Tom Lane wrote: > Szymon Guz writes: > > On 6 September 2013 01:00, Janek Sendrowski wrote: > >> I

Re: [GENERAL] Levenshtein Distance with more than 255 characters

2013-09-06 Thread Janek Sendrowski
Do you know the destination. I cant find it.

[GENERAL] are WAL file segment boundaries a point of consistency?

2013-09-06 Thread John Lumby
We use logshipping replication,    and have recently noticed a nasty bug  where, in certain very rare cases, the primary archive_command program will fail to send the WAL file to the standby but report good return code 0 to postgresql. In such cases,  if the standby then  triggers its termination

Re: [GENERAL] SQL Path in psql

2013-09-06 Thread miles
Bobby Dewitt wrote > I come from an Oracle background and I am fairly new to Postgres. > Oracle's command line utility (SQL*Plus) uses an environment variable > called SQLPATH to search the given directories for SQL scripts that the > user calls to execute using a method similar to the \i meta-com

Re: [GENERAL] PK referenced function

2013-09-06 Thread Agustin Larreinegabe
Thanks a lot On Fri, Sep 6, 2013 at 9:51 AM, Michael Paquier wrote: > On Fri, Sep 6, 2013 at 10:26 PM, Agustin Larreinegabe > wrote: > > I want to know if exists a postgres function or some easy way to know if > a > > PK in a table is already referenced in another table/tables. > psql has all y

Re: [GENERAL] psql client memory usage

2013-09-06 Thread Merlin Moncure
On Fri, Sep 6, 2013 at 8:19 AM, Tim Kane wrote: > Ahh. All these years (albeit sporadic), I never knew about FETCH_COUNT. > That makes sense. Thanks muchly. Not your fault: FETCH_COUNT is a hack IMO. The real issue was that libpq (until recently) forced the entire result into memory before it wa

Re: [GENERAL] PK referenced function

2013-09-06 Thread Michael Paquier
On Fri, Sep 6, 2013 at 10:26 PM, Agustin Larreinegabe wrote: > I want to know if exists a postgres function or some easy way to know if a > PK in a table is already referenced in another table/tables. psql has all you want for that. For example in this case: =# create table aa (a int primary key);

Re: [GENERAL] PK referenced function

2013-09-06 Thread Serge Fonville
Hi Augustin, PostgreSQL has a couple of possibilities in this regard. For example, http://stackoverflow.com/questions/1152260/postgres-sql-to-list-table-foreign-keyshas a couple of very clear queries. Additionally, it would be very useful if you could further clarify the problem you are trying to

[GENERAL] PK referenced function

2013-09-06 Thread Agustin Larreinegabe
Hi everyone: I want to know if exists a postgres function or some easy way to know if a PK in a table is already referenced in another table/tables. e.g. I want to delete a row but first I've got to change or delete in the table/tables where is referenced, and I have many table where could be ref

Re: [GENERAL] psql client memory usage

2013-09-06 Thread Tim Kane
Ahh. All these years (albeit sporadic), I never knew about FETCH_COUNT. That makes sense. Thanks muchly. On 06/09/2013 14:11, "Suzuki Hironobu" wrote: >(13/09/06 21:06), Tim Kane wrote: >> Hi all, >> >> I have a fairly simple query, running on a particularly large table. >>For >> illustration

Re: [GENERAL] How to check if any WAL file is missing in archive folder

2013-09-06 Thread Michael Paquier
On Fri, Sep 6, 2013 at 4:04 PM, Albe Laurenz wrote: > ascot.m...@gmail.com wrote: >> I am planing to backup archived WAL files from master to another machine, is >> there a way to check and >> make sure the backup archive file are all good and no any file missing or >> corrupted? > > The only 10

Re: [GENERAL] psql client memory usage

2013-09-06 Thread Suzuki Hironobu
(13/09/06 21:06), Tim Kane wrote: Hi all, I have a fairly simple query, running on a particularly large table. For illustration: echo "select * from really_big_table;" | psql my_database > /dev/null When I monitor the memory usage of the psql session, it continually grows. In fact, for this

Re: [GENERAL] Old record migration to another table made the db slower

2013-09-06 Thread Michael Paquier
On Thu, Sep 5, 2013 at 6:05 PM, Tomas Vondra wrote: > On 5 Září 2013, 8:52, Arun P.L wrote: >> Actual intention of the migration of old records was to >> speed up the original_data_table which is used frequently by users. How >> can I get this problem get this fixed? What are the steps to be follo

Re: [GENERAL] psql client memory usage

2013-09-06 Thread Daniel Verite
Tim Kane wrote: > I have a fairly simple query, running on a particularly large table. For > illustration: > > echo "select * from really_big_table;" | psql my_database > /dev/null See psql's FETCH_COUNT. From the manpage: FETCH_COUNT If this variable is set t

[GENERAL] psql client memory usage

2013-09-06 Thread Tim Kane
Hi all, I have a fairly simple query, running on a particularly large table. For illustration: echo "select * from really_big_table;" | psql my_database > /dev/null When I monitor the memory usage of the psql session, it continually grows. In fact, for this particularly large table ­ it grows

Re: [GENERAL] pg_dump question (exclude schemas)

2013-09-06 Thread vinayak
>I want to backup a database but exclude certain schemas with a patter. >I have 100 schemas with the pattern: 'sch_000', 'sch_001', and so on. >Will this work? >$pg_dump --exclude-schema='sch_*' >this does not seem to exclude all schemas with this pattern ( 'sch_*' ), >anything wrong here? >t

Re: [GENERAL] My Experiment of PG crash when dealing with huge amount of data

2013-09-06 Thread 高健
Hello: Sorry for disturbing again. Some of my friends told me about cgroups, So I tried it first. I found that cgroups can work for task such as wget. But it can't work for my postgres process. [root@cent6 Desktop]# cat /etc/cgconfig.conf # # Copyright IBM Corporation. 2007 # # Authors: Balbi

Re: [GENERAL] Failed to autoconvert '1' to text.

2013-09-06 Thread Szymon Guz
On 6 September 2013 10:33, Richard Huxton wrote: > On 06/09/13 09:13, Szymon Guz wrote: > >> Hi, >> why isn't 'aa' always treated as string? >> > > with x as ( >>select >>'1' a, >>'2' b >> ) >> SELECT levenshtein(a, b), length(a) >> FROM x; >> >> ERROR: failed to find conversion fun

Re: [GENERAL] Failed to autoconvert '1' to text.

2013-09-06 Thread Richard Huxton
On 06/09/13 09:13, Szymon Guz wrote: Hi, why isn't 'aa' always treated as string? with x as ( select '1' a, '2' b ) SELECT levenshtein(a, b), length(a) FROM x; ERROR: failed to find conversion function from unknown to text Why should I cast '1' to '1'::TEXT to satisfy a function

[GENERAL] Failed to autoconvert '1' to text.

2013-09-06 Thread Szymon Guz
Hi, why isn't 'aa' always treated as string? While testing function for levenshtein distance I've noticed that: with x as ( select '1' a, '2' b ) SELECT levenshtein(a, b), length(a) FROM x; ERROR: failed to find conversion function from unknown to text with x as ( select '1'::TEXT a,

Re: [GENERAL] Is this a bug in ECPG?

2013-09-06 Thread Boszormenyi Zoltan
2013-09-06 02:57 keltezéssel, Wang, Jing írta: Hi, ECPG don't support the following scenario: char cur_name = "cur1"; EXEC SQL DECLARE :cur_name CURSOR FOR ... EXEC SQL OPEN :cur_name; EXEC SQL FETCH cur1 INTO... ... EXEC SQL CLOSE :cur_name; An compile error will occur for above codes b

Re: [GENERAL] Levenshtein Distance with more than 255 characters

2013-09-06 Thread Szymon Guz
On 6 September 2013 08:47, Tom Lane wrote: > Szymon Guz writes: > > On 6 September 2013 01:00, Janek Sendrowski wrote: > >> I'm searching for an optimized Levenshtein Distance like Postgresql's. > My > >> problem is that I want to compare strings with a length over 255 > characters. > >> Does a

Re: [GENERAL] How to check if any WAL file is missing in archive folder

2013-09-06 Thread Albe Laurenz
ascot.m...@gmail.com wrote: > I am planing to backup archived WAL files from master to another machine, is > there a way to check and > make sure the backup archive file are all good and no any file missing or > corrupted? The only 100% safe way would be to restore them, e.g. with a standby data