Re: [GENERAL] How to store multiple rows in array .

2017-11-19 Thread Pavel Stehule
2017-11-19 18:57 GMT+01:00 Brahmam Eswar : > Hi , > > System is migrating from Oracle to Postgre SQL. > Oracle is providing BULK COLLECT INTO function to collect the multiple > records from table . > > Select COL1,COL2 ,COL3 BULK COLLECT INTO LINES from Distinct_Records. > > LINES IS TABLE OF TA

Re: [GENERAL] expanded auto and header linestyle double

2017-11-16 Thread Pavel Stehule
2017-11-16 21:16 GMT+01:00 Matt Zagrabelny : > Thanks for the reply, Pavel! > > On Thu, Nov 16, 2017 at 1:01 AM, Pavel Stehule > wrote: > >> Hi >> >> 2017-11-15 23:37 GMT+01:00 Matt Zagrabelny : >> >>> Greetings, >>> >>> Usin

Re: [GENERAL] Build in function to verify email addresses

2017-11-16 Thread Pavel Stehule
Hi 2017-11-16 8:56 GMT+01:00 Nick Dro : > I beleieve that every information system has the needs to send emails. > Currently PostgreSQL doesn't have a function which gets TEXT and return > true if it's valid email address (x...@yyy.com / .co.ZZ) > Do you believe such function should exist in Post

Re: [GENERAL] expanded auto and header linestyle double

2017-11-15 Thread Pavel Stehule
Hi 2017-11-15 23:37 GMT+01:00 Matt Zagrabelny : > Greetings, > > Using PG 10.1. > > In my .psqlrc I have: > > \x auto > \pset linestyle 'unicode' > \pset unicode_header_linestyle double > > and when the output is expanded, I do not see a double line for the first > record, but I do for all subseq

Re: [GENERAL] Using Variables in Queries

2017-10-19 Thread Pavel Stehule
. > > I still think that using server side variable is a much easier and > intuitive way of doing this. All of the alternatives have major flaws. > > On 10/19/2017 8:40 AM, Pavel Stehule wrote: > > There was lot of discussion about server side variables > https://w

Re: [GENERAL] Using Variables in Queries

2017-10-19 Thread Pavel Stehule
Hi 2017-10-19 17:21 GMT+02:00 Igal @ Lucee.org : > Hello, > > In other database servers, which I'm finally dropping in favor of > Postgres, I can do the following (mind you that this is for illustration > only, I do not actually write queries like that): > > DECLARE @query varchar(64) = 'red widg

Re: [GENERAL] Catching errors inside a LOOP is causing performance issues

2017-09-28 Thread Pavel Stehule
2017-09-28 10:08 GMT+02:00 Denisa Cirstescu : > Hi Tom, > > > > You said that trapping an *arbitrary* exception is a “fairly expensive > mechanism”. > > What if the: > > > > begin > > …. > > exception when others > > then null; > > end; > > > > would be replaced with > > > > begin > >

Re: [GENERAL] Is float8 a reference type?

2017-09-22 Thread Pavel Stehule
2017-09-23 5:10 GMT+02:00 Paul A Jungwirth : > On Fri, Sep 22, 2017 at 8:05 PM, Pavel Stehule > wrote: > > yes, it is 8 bytes on 64-bit. > > Thanks! > > > I don't think so it is good idea to write 64bit only extensions. > > I agree, but how ab

Re: [GENERAL] Is float8 a reference type?

2017-09-22 Thread Pavel Stehule
2017-09-23 4:52 GMT+02:00 Paul A Jungwirth : > The docs say that a Datum can be 4 bytes or 8 depending on the machine: > > https://www.postgresql.org/docs/9.5/static/sql-createtype.html > > Is a Datum always 8 bytes for 64-bit architectures? > > And if so, can my C extension skip a loop like this

Re: [GENERAL] Dynamic use of RAISE with USING to generate and catch non-hardcoded custom exceptions

2017-09-21 Thread Pavel Stehule
DECLARE >> >> >> v_msg TEXT := '''SOMETHING IS WRONG'''; >> >> v_sqlstate TEXT := '''E0001'''; >> >> v1 TEXT ; >> >> >> BEGIN >> >> v1 := v_msg || ' USING errcode = ' || v_sqlstate; >> >> RAISE NOTICE '%', v1; >> >> RAISE EXCEPTION '%', v1; >> >> >> EXCEPTION >> >> WHEN SQLSTATE 'E0001' THE

Re: [GENERAL] Dynamic use of RAISE with USING to generate and catch non-hardcoded custom exceptions

2017-09-21 Thread Pavel Stehule
2017-09-22 1:40 GMT+02:00 mike davis : > I’m trying to get dynamic version of the RAISE command working so that I > can use a table of custom application error messages and codes for use by > all developed plpgsql functions. In this way the customer error codes and > message are not hard coded int

Re: [GENERAL] libpq confusion

2017-09-19 Thread Pavel Stehule
2017-09-20 5:36 GMT+02:00 Igor Korot : > Hi, ALL, > > draft=# SELECT 1 FROM abcattbl WHERE abt_tnam = 'leagues'; > ?column? > -- > (0 rows) > > > However running it thru the PQexecParam() I am getting "PGRES_TUPLES_OK" > which means that the such record exist. > That means so this comman

Re: [GENERAL] a JOIN to a VIEW seems slow

2017-09-14 Thread Pavel Stehule
2017-09-14 15:09 GMT+02:00 Pavel Stehule : > > > 2017-09-14 14:59 GMT+02:00 Frank Millman : > >> Pavel Stehule wrote: >> >> 2017-09-14 10:14 GMT+02:00 Frank Millman : >> >>> Hi all >>> >>> This is a follow-up to a recent question I

Re: [GENERAL] a JOIN to a VIEW seems slow

2017-09-14 Thread Pavel Stehule
2017-09-14 14:59 GMT+02:00 Frank Millman : > Pavel Stehule wrote: > > 2017-09-14 10:14 GMT+02:00 Frank Millman : > >> Hi all >> >> This is a follow-up to a recent question I posted regarding a slow query. >> I thought that the slowness was caused by the numbe

Re: [GENERAL] a JOIN to a VIEW seems slow

2017-09-14 Thread Pavel Stehule
2017-09-14 10:14 GMT+02:00 Frank Millman : > Hi all > > This is a follow-up to a recent question I posted regarding a slow query. > I thought that the slowness was caused by the number of JOINs in the query, > but with your assistance I have found the true reason. I said in the > previous thread t

Re: [GENERAL] Joining 16 tables seems slow

2017-09-12 Thread Pavel Stehule
2017-09-12 14:01 GMT+02:00 Tom Lane : > "Frank Millman" writes: > > Pavel Stehule wrote: > >> 2017-09-12 8:45 GMT+02:00 Frank Millman : > >>> I am experimenting with optimising a SQL statement. One version uses > 4 LEFT JOIN’s and a 5-way CASE

Re: [GENERAL] Joining 16 tables seems slow

2017-09-12 Thread Pavel Stehule
2017-09-12 12:39 GMT+02:00 Pavel Stehule : > > > 2017-09-12 12:25 GMT+02:00 Frank Millman : > >> Pavel Stehule wrote: >> >> 2017-09-12 9:36 GMT+02:00 Frank Millman : >> >>> Pavel Stehule wrote: >>> > >>> > 2017-09-12

Re: [GENERAL] Joining 16 tables seems slow

2017-09-12 Thread Pavel Stehule
2017-09-12 12:25 GMT+02:00 Frank Millman : > Pavel Stehule wrote: > > 2017-09-12 9:36 GMT+02:00 Frank Millman : > >> Pavel Stehule wrote: >> > >> > 2017-09-12 8:45 GMT+02:00 Frank Millman : >> >>> I am using 9.4.4 on Fedora 22. >>>

Re: [GENERAL] Joining 16 tables seems slow

2017-09-12 Thread Pavel Stehule
2017-09-12 9:36 GMT+02:00 Frank Millman : > Pavel Stehule wrote: > > > > 2017-09-12 8:45 GMT+02:00 Frank Millman : > >> I am using 9.4.4 on Fedora 22. >> >> I am experimenting with optimising a SQL statement. One version uses 4 >> LEFT JOIN’s and a 5-

Re: [GENERAL] Joining 16 tables seems slow

2017-09-11 Thread Pavel Stehule
hi 2017-09-12 8:45 GMT+02:00 Frank Millman : > Hi all > > I am using 9.4.4 on Fedora 22. > > I am experimenting with optimising a SQL statement. One version uses 4 > LEFT JOIN’s and a 5-way CASE statement in the body. The second moves the > filtering into the JOIN section, and I end up with 16 LE

Re: [GENERAL] DROP [TEMP] TABLE syntax, as reason why not?

2017-08-24 Thread Pavel Stehule
2017-08-24 11:46 GMT+02:00 Vincenzo Romano : > 2017-08-24 11:04 GMT+02:00 Pavel Stehule : > > > > > > 2017-08-24 9:11 GMT+02:00 Vincenzo Romano : > >> > >> 2017-08-24 3:08 GMT+02:00 Tom Lane : > >> > "David G. Johnston" writes: &g

Re: [GENERAL] DROP [TEMP] TABLE syntax, as reason why not?

2017-08-24 Thread Pavel Stehule
2017-08-24 9:11 GMT+02:00 Vincenzo Romano : > 2017-08-24 3:08 GMT+02:00 Tom Lane : > > "David G. Johnston" writes: > >> I'm wondering if there is anything technical preventing someone from > making: > > > >> DROP TEMP TABLE tablename; > > > > There is no great need for that because you can get th

Re: [GENERAL] 'value too long' and before insert/update trigger

2017-08-23 Thread Pavel Stehule
Hi 2017-08-24 7:08 GMT+02:00 Kevin Golding : > Hi all > I'm currently migrating a legacy Informix 4gl application to run on > PostgreSQL (v9.5.8) > > There are errors occurring because sometimes the application tries to > insert/update values longer than the definition of the database column. > T

Re: [GENERAL] Receive a string in Composite-type Arguments

2017-08-11 Thread Pavel Stehule
Hi you have to build tuple first. Later you can got a HeapTupleHeader pl_toolbox has some functions for composite types https://github.com/okbob/pltoolbox Regards Pavel Stehule > > Why do you want to convert this to HeapTupleHeader since this is *not* a > tuple but a string value

Re: [GENERAL] Long wrapped header lines in psql with expanded mode (9.6.3)

2017-07-13 Thread Pavel Stehule
2017-07-13 14:40 GMT+02:00 Simon Ruderich : > Hello, > > I'm using the following minimal ~/.psqlrc: > > \pset expanded on > > Now when I select rows from a table which are too long to fit the > screen then I get this output: > > simon=> table test; > -[ RECORD 1 ]--

Re: [GENERAL] Is PL-PGSQL interpreted or complied?

2017-07-05 Thread Pavel Stehule
2017-07-06 2:10 GMT+02:00 Tim Uckun : > I am curious about the stored proc languages inside of postgres. When I > write a stored proc is it compiled to some internal representation or just > interpreted? How does this work with other languages? > The PLpgSQL proc are saved in original form - you

Re: [GENERAL] Inconsistent performance with LIKE and bind variable on long-lived connection

2017-06-11 Thread Pavel Stehule
2017-06-11 18:34 GMT+02:00 Steven Grimm : > On Sun, Jun 11, 2017 at 8:21 AM, Tom Lane wrote: > >> Yeah, I've been watching this thread and trying to figure out how to >> explain that part; I suspected a cause of this form but couldn't >> make that theory match the 9-iterations observation. (I st

Re: [GENERAL] Oracle database into PostgreSQL using Ora2PG tool.

2017-06-02 Thread Pavel Stehule
2017-06-02 11:15 GMT+02:00 PAWAN SHARMA : > > On Fri, Jun 2, 2017 at 2:13 PM, Pavel Stehule > wrote: > >> Hi >> >> 2017-06-02 10:16 GMT+02:00 PAWAN SHARMA : >> >>> Hi All, >>> >>> I am migrating Oracle database into PostgreSQL us

Re: [GENERAL] Oracle database into PostgreSQL using Ora2PG tool.

2017-06-02 Thread Pavel Stehule
Hi 2017-06-02 10:16 GMT+02:00 PAWAN SHARMA : > Hi All, > > I am migrating Oracle database into PostgreSQL using Ora2PG tool. > > So, I am facing one issue with trigger after generating script output of > Oracle database. > > *Oracle : * > > CREATE OR REPLACE TRIGGER UPDATE_JOB_HISTORY > AFTER

Re: [GENERAL] Current best practice for maximum shared_buffers settings on big hardware?

2017-05-24 Thread Pavel Stehule
2017-05-24 15:02 GMT+02:00 stevenchang1213 : > hello, > at most 40% total memory, official doc also says so. > you can testify it using pg_prewarm and pgfincore . > There are strong dependency on use case. 40% total memory is related to low memory servers .. 64GB max. High SB requires tuning oth

Re: [GENERAL] Error that shouldn't happen?

2017-05-18 Thread Pavel Stehule
2017-05-18 22:39 GMT+02:00 Rob Brucks : > Thanks. > > > > I can code an exception block to handle the table problem, and probably > one for the index collision too. > Creating partitions dynamically is pretty bad idea. You have to handle a exceptions - it enforces implicit subtransaction (some sl

Re: [GENERAL] PSQL command line print speed

2017-05-17 Thread Pavel Stehule
Hi 2017-05-17 18:03 GMT+02:00 Adrian Myers : > Is there a way to speed up the actual line-by-line display of the psql > console in version 8.4? > > Queries which perform in a few milliseconds through a driver (psycopg2 in > this case) can take several seconds or minutes to complete in the console

Re: [GENERAL] Questions regarding JSON processing

2017-04-26 Thread Pavel Stehule
;updated" > that contain objected to be added and updated inside it. I think this kind > of branching should be safe though? > > On Wed, Apr 26, 2017 at 12:41 PM, Pavel Stehule > wrote: > >> >> >> 2017-04-26 6:21 GMT+02:00 Glen Huang : >> >>&g

Re: [GENERAL] GENERAL - [How to check if the array contains the element.]

2017-04-26 Thread Pavel Stehule
Hi 2017-04-26 13:33 GMT+02:00 Andreas Kretschmer : > > > Am 26.04.2017 um 13:24 schrieb VENKTESH GUTTEDAR: > >> Hello All, >> >> How do i check if any one element of one array exists in another >> array. >> Eg: >> array1 = [1,2,3,4] >> array2 = [1,4,5,7] >> Now i expec

Re: [GENERAL] Questions regarding JSON processing

2017-04-25 Thread Pavel Stehule
2017-04-26 6:21 GMT+02:00 Glen Huang : > Hi all, > > I have a RESTful API server that sends and receives JSON strings. I'm > wondering what might be the best way to leverage PostgreSQL's JSON > capability. > > For sending JSON responses to clients. I believe the best way is to ask > PostgreSQL to

Re: [GENERAL] potential extension of psql's \df+ ?

2017-04-19 Thread Pavel Stehule
2017-04-19 12:14 GMT+02:00 Karsten Hilbert : > On Wed, Apr 19, 2017 at 12:00:04PM +0200, Pavel Stehule wrote: > > > > Hence I wonder whether an approach along these lines: > > > > > > select > > > row_number()

Re: [GENERAL] potential extension of psql's \df+ ?

2017-04-19 Thread Pavel Stehule
Hi 2017-04-19 11:55 GMT+02:00 Karsten Hilbert : > Hi all ! > > Every so often, when working with functions, errors get > reported with context information similar to this: > > Context: PL/pgSQL function "test_function" line 5 at SQL statement > > Often, the function source is kept under v

Re: [GENERAL] Query never completes with low work_mem (at least not within one hour)

2017-04-05 Thread Pavel Stehule
2017-04-05 10:33 GMT+02:00 Daniel Westermann < daniel.westerm...@dbi-services.com>: > 2017-04-05 10:13 GMT+02:00 Daniel Westermann services.com>: > >> 2017-04-05 9:28 GMT+02:00 Daniel Westermann > services.com>: >> >>> >>what is result of EXPLAIN statement for slow and fast cases? >>> >> >>> >>re

Re: [GENERAL] Query never completes with low work_mem (at least not within one hour)

2017-04-05 Thread Pavel Stehule
2017-04-05 10:13 GMT+02:00 Daniel Westermann < daniel.westerm...@dbi-services.com>: > 2017-04-05 9:28 GMT+02:00 Daniel Westermann services.com>: > >> >>what is result of EXPLAIN statement for slow and fast cases? >> >> >> >>regards >> >> >> >>Pavel >> >> For work_mem=32MB >> >> explain (analyze,v

Re: [GENERAL] Query never completes with low work_mem (at least not within one hour)

2017-04-05 Thread Pavel Stehule
2017-04-05 9:28 GMT+02:00 Daniel Westermann < daniel.westerm...@dbi-services.com>: > >>what is result of EXPLAIN statement for slow and fast cases? > >> > >>regards > >> > >>Pavel > > For work_mem=32MB > > explain (analyze,verbose,buffers) select count(user_id) from users where > user_id not in (

Re: [GENERAL] Query never completes with low work_mem (at least not within one hour)

2017-04-05 Thread Pavel Stehule
2017-04-05 8:57 GMT+02:00 Daniel Westermann < daniel.westerm...@dbi-services.com>: > >> I have set work_mem to a very low value intentionally for demonstration > >> purposes: > >> > >> postgres=# show work_mem; > >> work_mem > >> -- > >> 16MB > >> (1 row) > >> > >> postgres=# show shared

Re: [GENERAL] browser interface to forums please?

2017-03-24 Thread Pavel Stehule
Hi 2017-03-25 5:49 GMT+01:00 Yuri Budilov : > Hello everyone > Can these forums be moved to internet ? > It is on internet > All these emails is so 1990s. > And it is working well - there is not spam and ballast > So hard to follow, so hard to search for historical answers. > We really need

Re: [GENERAL] How to define the limit length for numeric type?

2017-03-11 Thread Pavel Stehule
2017-03-12 7:25 GMT+01:00 Pavel Stehule : > > > 2017-03-12 7:14 GMT+01:00 vod vos : > >> >> Hi everyone, >> >> How to define the exact limit length of numeric type? For example, >> >> CREATE TABLE test (id serial, goose numeric(4,1)); >> >

Re: [GENERAL] How to define the limit length for numeric type?

2017-03-11 Thread Pavel Stehule
2017-03-12 7:14 GMT+01:00 vod vos : > > Hi everyone, > > How to define the exact limit length of numeric type? For example, > > CREATE TABLE test (id serial, goose numeric(4,1)); > > 300.2 and 30.2 can be inserted into COLUMN goose, but I want 30.2 or 3.2 > can not be inserted, how to do this? >

Re: [GENERAL] Feature request - psql --quote-variable

2017-03-07 Thread Pavel Stehule
Any documentation enhancing is good. If you have a idea, please, send a text. Regards Pavel > > > On Tue, Feb 21, 2017 at 12:35 PM Pavel Stehule > wrote: > >> Hi >> >> 2017-02-21 15:19 GMT+01:00 Caleb Cushing : >> >> recently while exploring

Re: [GENERAL] Load a csv to remote postgresql database

2017-03-01 Thread Pavel Stehule
Hi 2017-03-02 7:01 GMT+01:00 priyanka raghav : > Hi, > > I am trying to load a csv file of approx 500mb to remote postgres > database. Earlier when the app server and db server were co-located, > COPY command was working fine but ever since the db server is moved to > a different box, the command

Re: [GENERAL] How to assign default values to psql variables?

2017-02-21 Thread Pavel Stehule
Hi 2017-02-22 6:00 GMT+01:00 Torsten Förtsch : > Hi, > > I have a psql script relying on variables passed in on the command line > with -v. > > Is there any way to assign a default value in case the -v option is > forgotten? > > Here is an example with pgtap: > > select diag('should be printed on

Re: [GENERAL] Feature request - psql --quote-variable

2017-02-21 Thread Pavel Stehule
Hi 2017-02-21 15:19 GMT+01:00 Caleb Cushing : > recently while exploring this problem http://stackoverflow.com/q/ > 40945277/206466. I decided to go with the docker container approach of a > shell script. > > I realized that postgres' variables aren't quoted either, which results > in me quoting

Re: [GENERAL] Problems with Greatest

2017-02-15 Thread Pavel Stehule
2017-02-16 5:38 GMT+01:00 Teddy Schmitz : > As a quick follow up I just did an explain on the query, > > > Aggregate (cost=258007258.87..258007258.88 rows=1 width=8) > -> Nested Loop (cost=0.00..184292254.83 rows=14743000807 width=16) > -> Seq Scan on t1 (cost=0.00..3796.41 rows=263141 width=

Re: [GENERAL] database folder name and tables filenames

2017-02-14 Thread Pavel Stehule
2017-02-14 18:47 GMT+01:00 Mimiko : > On 14.02.2017 17:30, Adrian Klaver wrote: > >> Is there a way to change postgres behavior to name database folders by >>> the database name? And table files in them by table's name? And not >>> using OIDs. >>> >> >> No. >> >> Is there a particular problem you

Re: [GENERAL] Bad planning data resulting in OOM killing of postgres

2017-02-13 Thread Pavel Stehule
Hi 2017-02-13 18:40 GMT+01:00 David Hinkle : > I'm having trouble with purges related to a large table. The delete > query consumes ram until postgres crashes due to OOM. I have a very > large table called log_raw. There are half a dozen related tables, > such as 'urls' and 'titles'. log_r

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Pavel Stehule
2017-02-11 19:51 GMT+01:00 Alexander Farber : > At the same time this advice from > http://stackoverflow.com/questions/42179012/how-to- > shuffle-array-in-postgresql-9-6-and-also-lower-versions > works, don't know why though: > > words=> select array_agg(u order by random()) > words-> from unnest(

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Pavel Stehule
Hi 2017-02-11 17:37 GMT+01:00 Alexander Farber : > Good evening, > > after switching to 9.6.2 from 9.5.3 the following custom function has > stopped working: > > CREATE OR REPLACE FUNCTION words_shuffle(in_array varchar[]) > RETURNS varchar[] AS > $func$ > SELECT array_agg(letters

Re: [GENERAL] create trigger in postgres to check the password strength

2017-02-03 Thread Pavel Stehule
2017-02-03 17:17 GMT+01:00 Pavel Stehule : > Hi > > 2017-02-03 16:14 GMT+01:00 PAWAN SHARMA : > >> Hi All, >> >> Is this possible to create trigger in postgres to check the password >> strength( like char should be min 8 character) while to creating user o

Re: [GENERAL] create trigger in postgres to check the password strength

2017-02-03 Thread Pavel Stehule
Hi 2017-02-03 16:14 GMT+01:00 PAWAN SHARMA : > Hi All, > > Is this possible to create trigger in postgres to check the password > strength( like char should be min 8 character) while to creating user or > role with password. > > If it possible can you please share the script with me.. > yes, i

Re: [GENERAL] COPY to question

2017-01-17 Thread Pavel Stehule
2017-01-17 19:23 GMT+01:00 Rich Shepard : > Running -9.6.1. I have a database created and owned by me, but cannot > copy > a table to my home directory. Postgres tells me it cannot write to that > directory. The only way to copy tables to files is by doing so as the > superuser (postgres). > >

Re: [GENERAL] Column Tetris Automatisation

2017-01-15 Thread Pavel Stehule
Hi 2017-01-15 10:58 GMT+01:00 Nicolas Paris : > Hello, > > In postgresl order of columns does have an non negligeable impact on table > size[1]. > Table are in many cases dynamic, and new fields can appear in the database > life. > I suspect re-ordering columns based on types would be an automati

Re: [GENERAL] raise notice question

2017-01-14 Thread Pavel Stehule
Hi 2017-01-14 17:29 GMT+01:00 ProPAAS DBA : > Is it possible to execute a raise notice without the "Notice" keyword > being part of the output, or is there another construct that allows writing > to output as simple informational text (without any sort of NOTICE, > WARNING, etc being part of the

Re: [GENERAL] COPY value TO STDOUT

2017-01-14 Thread Pavel Stehule
* > > *$$ language sql;* > You cannot do it in plain text language. The identifier of column or table have not be a variable ever. You can use dynamic SQL in PLpgSQL - where SQL command is created in run-time and there you can do what you want. Use plpgsql and EXECUTE statement https://www.postgresql.org/docs/current/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN Regards Pavel Stehule

Re: [GENERAL] Means to emulate global temporary table

2017-01-12 Thread Pavel Stehule
Hi 2017-01-12 10:06 GMT+01:00 Karsten Hilbert : > On Wed, Jan 11, 2017 at 05:54:11PM -0700, David G. Johnston wrote: > > > I don't see where "call a setup function immediately after connecting" > > Sounds like a "login trigger", more generally an ON CONNECT > event trigger, which we don't have at

Re: [GENERAL] COPY: row is too big

2017-01-05 Thread Pavel Stehule
2017-01-05 13:44 GMT+01:00 vod vos : > I finally figured it out as follows: > > 1. modified the corresponding data type of the columns to the csv file > > 2. if null values existed, defined the data type to varchar. The null > values cause problem too. > int, float, double can be null too - null

Re: [GENERAL] vacuum of empty table slows down as database table count grows

2017-01-04 Thread Pavel Stehule
> > >> > >> > This is irrelevant of amount of data restored, i am seeing the same >> behavior with just schema restore, as well as with schema+data restores. >> > >> > If anyone is interested i may upload the schema data + my benchmarking >> script with collected whisper data from my test run (i've

Re: [GENERAL] vacuum of empty table slows down as database table count grows

2017-01-04 Thread Pavel Stehule
2017-01-04 20:22 GMT+01:00 Jerry Sievers : > marcin kowalski writes: > > > I am experiencing an odd issue, i've noticed it on 9.3 , but i can > reproduce it on 9.6. > > > > Basically, i have a database with a lot of schemas, but not that much > data. Each schema is maybe 2-4 GB in size, and often

Re: [GENERAL] COPY: row is too big

2017-01-04 Thread Pavel Stehule
2017-01-04 16:11 GMT+01:00 Adrian Klaver : > On 01/04/2017 06:54 AM, Pavel Stehule wrote: > >> Hi >> >> 2017-01-04 14:00 GMT+01:00 vod vos > <mailto:vod...@zoho.com>>: >> >> __ >> Now I am confused about I can create 1100 columns

Re: [GENERAL] COPY: row is too big

2017-01-04 Thread Pavel Stehule
Hi 2017-01-04 14:00 GMT+01:00 vod vos : > Now I am confused about I can create 1100 columns in a table in > postgresql, but I can't copy 1100 values into the table. And I really dont > want to split the csv file to pieces to avoid mistakes after this action. > The PostgreSQL limit is "Maximum Co

Re: [GENERAL] Book or other resource on Postgres-local code?

2016-12-29 Thread Pavel Stehule
2016-12-30 8:04 GMT+01:00 Guyren Howe : > > > On Dec 29, 2016, at 23:01 , Regina Obe wrote: > > > > > >> As an aside from my last question about my LYDB effort: > > > >> https://medium.com/@gisborne/love-your-database-lydb- > 23c69f480a1d#.4jngp2rcb > > > >> I would like to find a book or other r

Re: [GENERAL] Performance PLV8 vs PLPGSQL

2016-12-29 Thread Pavel Stehule
2016-12-29 10:03 GMT+01:00 Tim Uckun : > I think it's awesome that postgres allows you to code in different > languages like this. It really is a unique development environment and one > that is overlooked as a development platform. It would be nice if more > languages were delivered in the defau

Re: [GENERAL] Performance PLV8 vs PLPGSQL

2016-12-29 Thread Pavel Stehule
be good. More you can use a "format" function - implemented in C. Regards Pavel > > On Thu, Dec 29, 2016 at 10:00 PM, Pavel Stehule > wrote: > >> >> >> 2016-12-29 9:23 GMT+01:00 Tim Uckun : >> >>> I am not doubting the efficacy of stored

Re: [GENERAL] Performance PLV8 vs PLPGSQL

2016-12-29 Thread Pavel Stehule
2016-12-29 9:23 GMT+01:00 Tim Uckun : > I am not doubting the efficacy of stored procs, just wondering which > language is better. From the sound of it string manupilation is slow in > PL-PGSQL but looking at my procs there does seem to be a lot of string > manipulation going on so maybe I better

Re: [GENERAL] Indexes and loops

2016-12-28 Thread Pavel Stehule
Hi 2016-12-27 19:05 GMT+01:00 Арсен Арутюнян : > Hello. > > I have a few questions: > > 1) JobStatusTest1 function has only one request and JobStatusTest2 > function has as many as six requests. > > Why function JobStatusTest2 is faster? > > > JobStatusTest1 : 981.596 ms > > JobStatusTest2 : 849

Re: [GENERAL] LYDB: What advice about stored procedures and other server side code?

2016-12-28 Thread Pavel Stehule
2016-12-28 16:12 GMT+01:00 Christoph Moench-Tegeder : > ## Guyren Howe (guy...@gmail.com): > > > I am inclined to advise folks to use PL/V8 on Postgres, because it is > > a reasonable language, everyone knows it, it has good string functions, > > decent performance and it tends to be installed eve

Re: [GENERAL] Performance PLV8 vs PLPGSQL

2016-12-28 Thread Pavel Stehule
2016-12-28 10:46 GMT+01:00 Pavel Stehule : > Hi > > 2016-12-28 10:15 GMT+01:00 Tim Uckun : > >> I have seen various links on the internet which indicate that PLV8 is >> significantly faster than PL-PGSQL sometimes an order of magnitude faster. >> >> Is this uni

Re: [GENERAL] Performance PLV8 vs PLPGSQL

2016-12-28 Thread Pavel Stehule
Hi 2016-12-28 10:15 GMT+01:00 Tim Uckun : > I have seen various links on the internet which indicate that PLV8 is > significantly faster than PL-PGSQL sometimes an order of magnitude faster. > > Is this uniformly true or is it just in certain circumstances? > It depends on usage > > Is there a

Re: [GENERAL] Is there a way to Send attachments with email using pgmail postgreSQl?

2016-12-19 Thread Pavel Stehule
Hi 2016-12-16 7:07 GMT+01:00 nidhi raina : > Dear Sir/Mam, > > I am also trying to send emails with attachments.please help me out with > this. > You can use a untrusted Perl or Python functions http://www.perlmonks.org/?node_id=603769 here is one example http://postgres.cz/wiki/PL/Perlu_-_Untr

Re: [GENERAL] pg_dump and quoted identifiers

2016-12-13 Thread Pavel Stehule
2016-12-13 17:38 GMT+01:00 Thomas Kellerer : > Inspired by this question: > >http://dba.stackexchange.com/q/158044/1822 > > I tried that for myself, and it seems that pg_dump indeed can not parse > quoted identifiers: > > psql (9.6.1) > Type "help" for help. > > postgres=# create t

Re: [GENERAL] Importing SQLite database

2016-12-10 Thread Pavel Stehule
2016-12-10 20:43 GMT+01:00 Pavel Stehule : > > > 2016-12-10 20:32 GMT+01:00 Igor Korot : > >> Hi, guys, >> I'm working thru my script and I hit a following issue: >> >> In the script I have a following command: >> >> CREATE TABLE playersinleagu

Re: [GENERAL] Importing SQLite database

2016-12-10 Thread Pavel Stehule
2016-12-10 20:32 GMT+01:00 Igor Korot : > Hi, guys, > I'm working thru my script and I hit a following issue: > > In the script I have a following command: > > CREATE TABLE playersinleague(id integer, playerid integer, ishitter > char, age integer, value decimal, currvalue decimal, draft boolean,

Re: [GENERAL] Multidimentional array access

2016-12-09 Thread Pavel Stehule
Hi 2016-12-09 16:05 GMT+01:00 VENKTESH GUTTEDAR : > Hello, > > I want to get the inner array in a multi dimentional array in a > pl/pgsql procedure. > > Eg : {{1,2,3,4,5,6,7},{11,22,33,44,55,66,77}} > > for i in array_lower(Eg, 1) .. array_upper(Eg, 1) > LOOP > array_value

Re: [GENERAL] When to use COMMENT vs --

2016-12-07 Thread Pavel Stehule
2016-12-07 16:57 GMT+01:00 Rich Shepard : > I have used '-- ' to enter comments about tables or columns and am > curious > about the value of storing comments in tables using the COMMENT key word. > When is the latter more appropriate than the former? > Description entered with COMMENT statemen

Re: [GENERAL] Avoid sorting when doing an array_agg

2016-12-04 Thread Pavel Stehule
2016-12-04 23:12 GMT+01:00 Peter Geoghegan : > On Sat, Dec 3, 2016 at 5:20 PM, Tomas Vondra > wrote: > > So the sort is probably slow because of CPU, as it compares strings. In > > some locales that may be very expensive - not sure which locale is used > > in this case, as it was not mentioned. >

Re: [GENERAL] Strict min and max aggregate functions

2016-11-20 Thread Pavel Stehule
2016-11-20 20:18 GMT+01:00 Jeff Janes : > On Sun, Nov 20, 2016 at 2:45 AM, Pavel Stehule > wrote: > >> >> >> 2016-11-19 22:12 GMT+01:00 Jeff Janes : >> >>> I need "strict" MIN and MAX aggregate functions, meaning they return >>> NULL

Re: [GENERAL] Strict min and max aggregate functions

2016-11-20 Thread Pavel Stehule
2016-11-19 22:12 GMT+01:00 Jeff Janes : > I need "strict" MIN and MAX aggregate functions, meaning they return NULL > upon any NULL input, and behave like the built-in aggregates if none of the > input values are NULL. > > This doesn't seem like an outlandish thing to want, and I'm surprised I > c

[GENERAL] Re: [GENERAL] FTS query, statistics and planner estimations…

2016-11-09 Thread Pavel Stehule
2016-11-09 11:19 GMT+01:00 Pierre Ducroquet : > On Wednesday, November 9, 2016 10:40:10 AM CET Francisco Olarte wrote: > > Pierre: > > > > On Wed, Nov 9, 2016 at 10:22 AM, Pierre Ducroquet > > > > wrote: > > > The query does a few joins «after» running a FTS query on a main table. > > > The FTS q

[GENERAL] Re: [GENERAL] Re: [GENERAL] FTS query, statistics and planner estimations…

2016-11-09 Thread Pavel Stehule
2016-11-09 10:40 GMT+01:00 Francisco Olarte : > Pierre: > > On Wed, Nov 9, 2016 at 10:22 AM, Pierre Ducroquet > wrote: > > The query does a few joins «after» running a FTS query on a main table. > > The FTS query returns a few thousand rows, but the estimations are wrong, > > leading the optimize

Re: [GENERAL] slow performance of array_agg after upgrade from 9.2 to 9.5

2016-10-27 Thread Pavel Stehule
2016-10-26 15:06 GMT+02:00 jaroet : > Internally we upgraded from 9.2 to 9.5 en we had defined an median > function. > This became about 7 to 8 times slower using the same functions. > > They are defined like this: > > > CREATE OR REPLACE FUNCTION public._final_median(anyarray) > RETURNS double

Re: [GENERAL] Generic way to test input arguments

2016-10-18 Thread Pavel Stehule
2016-10-18 16:42 GMT+02:00 Saïd Assemlal : > I am writing database functions with plpgsql. (I am using Postgresql 9.4 > with centos 6) > > Here an example on what I would like to improve: > > CREATE OR REPLACE FUNCTION usp_locking_trial(p_trial_code VARCHAR(50), > p_trial_key VARCHAR(500)) > RETUR

Re: [GENERAL] Generic way to test input arguments

2016-10-17 Thread Pavel Stehule
Hi 2016-10-17 21:09 GMT+02:00 Raymond O'Donnell : > On 17/10/16 16:40, said assemlal wrote: > >> Hello, >> >> I am looking for a way to test generically input arguments to raise an >> exception if one is either null or empty. >> >> I was thinking to create a function who takes an array to check t

Re: [GENERAL] psql 9.3 automatic recovery in progress

2016-10-10 Thread Pavel Stehule
s://www.odoo.com/forum/help-1/question/reduce-memory-usage-54636 http://www.vionblog.com/openerp-server-conf-for-openerp-7-explained/ Regards Pavel > Thanks. > > On Mon, Oct 10, 2016 at 12:25 PM, Pavel Stehule > wrote: > >> >> >> 2016-10-10 21:12 GMT+02:00 Periko Su

Re: [GENERAL] psql 9.3 automatic recovery in progress

2016-10-10 Thread Pavel Stehule
2016-10-10 21:12 GMT+02:00 Periko Support : > Andreo u got a good observation here. > > I got a script that run every hour why? > > Odoo got some issues with IDLE connections, if we don't check our current > psql connections after a while the system eat all connections and a lot of > them are IDLE

Re: [GENERAL] HA Cluster Solution?

2016-10-10 Thread Pavel Stehule
hard to say if cluster helps - depends on data size - but odoo produces really strange queries - I am little bit sceptic. But I am sure, so cluster increase significantly maintenance costs. Regards Pavel > > On Sun, Oct 9, 2016 at 9:29 PM, Pavel Stehule > wrote: > > Hi > >

Re: [GENERAL] HA Cluster Solution?

2016-10-09 Thread Pavel Stehule
Hi 2016-10-10 6:22 GMT+02:00 Periko Support : > Hi. > > We are searching for a cluster solutions for postgresql, we need to > increase our current psql server performance running under ubuntu 14 > v9.3. > >The db is for odoo 7.x > I have some experience with odoo 7.x - there are lot of p

Re: [GENERAL] how to monitor the progress of really large bulk operations?

2016-09-28 Thread Pavel Stehule
2016-09-28 14:34 GMT+02:00 Mike Sofen : > *From:* Pavel Stehule*Sent:* Tuesday, September 27, 2016 9:18 PM > 2016-09-28 6:13 GMT+02:00 Pavel Stehule : > > Hi > > 2016-09-27 23:03 GMT+02:00 Mike Sofen : > > Hi gang, > > how to view the state of a transaction i

Re: [GENERAL] how to monitor the progress of really large bulk operations?

2016-09-27 Thread Pavel Stehule
2016-09-28 6:13 GMT+02:00 Pavel Stehule : > Hi > > 2016-09-27 23:03 GMT+02:00 Mike Sofen : > >> Hi gang, >> >> >> >> On PG 9.5.1, linux, I’m running some large ETL operations, migrate data >> from a legacy mysql system into PG, upwards of 250m row

Re: [GENERAL] how to monitor the progress of really large bulk operations?

2016-09-27 Thread Pavel Stehule
Hi 2016-09-27 23:03 GMT+02:00 Mike Sofen : > Hi gang, > > > > On PG 9.5.1, linux, I’m running some large ETL operations, migrate data > from a legacy mysql system into PG, upwards of 250m rows in a transaction > (it’s on a big box). It’s always a 2 step operation – extract raw mysql > data and p

Re: [GENERAL] Custom SQL function does not like IF-statement

2016-09-26 Thread Pavel Stehule
Hi 2016-09-26 20:22 GMT+02:00 Alexander Farber : > Good evening! > > For a 2-player game I am trying to create a custom SQL function, which > stores a new message (if not empty) into words_chat table and then return > all messages from that table for a given game: > > CREATE OR REPLACE FUNCTION

Re: [GENERAL] [HACKERS] temporary table vs array performance

2016-09-26 Thread Pavel Stehule
2016-09-26 17:39 GMT+02:00 dby...@163.com : > test: > create type h3 as (id int,name char(10)); > > CREATE or replace FUNCTION proc17() > RETURNS SETOF h3 AS $$ > DECLARE > v_rec h3; > BEGIN > create temp table abc(id int,name varchar) on commit drop; > insert into abc select 1,'lw'; > inser

Re: [GENERAL] push array to array

2016-09-18 Thread Pavel Stehule
2016-09-18 19:15 GMT+02:00 Pavel Stehule : > > > 2016-09-18 19:12 GMT+02:00 Pavel Stehule : > >> Hi >> >> >> 2016-09-18 18:46 GMT+02:00 Tjibbe : >> >>> '{{4,5},{8,3}}' + '{3,6}' >> >> >> postgres=# se

Re: [GENERAL] push array to array

2016-09-18 Thread Pavel Stehule
2016-09-18 19:12 GMT+02:00 Pavel Stehule : > Hi > > > 2016-09-18 18:46 GMT+02:00 Tjibbe : > >> '{{4,5},{8,3}}' + '{3,6}' > > > postgres=# select '{{4,5},{8,3}}'::int[] || ARRAY[[3,6]]; > +-+ > |

Re: [GENERAL] push array to array

2016-09-18 Thread Pavel Stehule
Hi 2016-09-18 18:46 GMT+02:00 Tjibbe : > '{{4,5},{8,3}}' + '{3,6}' postgres=# select '{{4,5},{8,3}}'::int[] || ARRAY[[3,6]]; +-+ | ?column? | +-+ | {{4,5},{8,3},{3,6}} | +-+ (1 row) regards Pavel

Re: [GENERAL] What limits Postgres performance when the whole database lives in cache?

2016-09-11 Thread Pavel Stehule
2016-09-11 9:23 GMT+02:00 dandl : > *From:* pgsql-general-ow...@postgresql.org [mailto:pgsql-general-owner@ > postgresql.org] *On Behalf Of *Pavel Stehule > > I guess my question then is: how much do you pay for that durability? If > you benchmark Postgres configured for pure in-me

  1   2   3   4   5   6   7   8   9   10   >