Re: [GENERAL] streaming replication across platforms

2015-03-05 Thread Pavel Stehule
Hi 2015-03-06 7:23 GMT+01:00 Alan Nilsson : > Is it possible to use streaming replication across different platforms > (OSX/linux)? > No, it is not possible - you have to use logical replication like Slony Regards Pavel Stehule > > As I read it, you must use a file system le

Re: [GENERAL] Performance slowing down when doing same UPDATE many times

2015-03-09 Thread Pavel Stehule
Hi it is side effect of MVCC implementation of Postgres. There is not possible vacuum inside open transaction. If you need it, then you should to use a different database - Postgres doesn't work well when one record is highly often used in transaction. Usual solution for Postgres is some proxy, t

Re: [GENERAL] How to read refcursor column's using string column name?

2015-03-12 Thread Pavel Stehule
2015-03-10 20:56 GMT+01:00 inspector morse : > How do I access a cursor's column using a string column? > > Example: > > CREATE FUNCTION write_html_select(items cursor, data_value_field text, > data_text_field text) > AS > $$ > DECLARE r RECORD; > html TEXT; > BEGIN > FOR r in

Re: [GENERAL] regclass and format('%I')

2015-03-14 Thread Pavel Stehule
2015-03-14 10:09 GMT+01:00 Jason Dusek : > It honestly seems far more reasonable to me that %s and %I should do > the exact same thing with regclass. My reasoning is as follows: > > ‘%I’ formats a something such that it is a valid identifier, > > regclass is already a valid identifier, > > therefo

Re: [GENERAL] regclass and format('%I')

2015-03-14 Thread Pavel Stehule
2015-03-15 3:09 GMT+01:00 Jason Dusek : > On 14 March 2015 at 09:17, David G. Johnston > wrote: > > On Saturday, March 14, 2015, Jason Dusek wrote: > >> It honestly seems far more reasonable to me that %s and %I should do > >> the exact same thing with regclass. My reasoning is as follows: > >>

Re: [GENERAL] Name spacing functions and stored procedures

2015-03-18 Thread Pavel Stehule
Hi 2015-03-19 2:56 GMT+01:00 Tim Uckun : > What do you guys do to namespace your functions so that they are not > jumbled in with the system functions and also somewhat hierarchically > organized. > > Obviously it's possible to create schemas for different namespaces but > that can lead to a lot

Re: [GENERAL] Name spacing functions and stored procedures

2015-03-19 Thread Pavel Stehule
2015-03-19 11:03 GMT+01:00 Tim Uckun : > I guess I see schemas as ways to group data not functions. > > It would be very nice to be able to group your code into proper modules > though. It's something I really miss. > what is advantage modules?

Re: [GENERAL] Name spacing functions and stored procedures

2015-03-19 Thread Pavel Stehule
2015-03-19 11:46 GMT+01:00 Pavel Stehule : > > > 2015-03-19 11:03 GMT+01:00 Tim Uckun : > >> I guess I see schemas as ways to group data not functions. >> >> It would be very nice to be able to group your code into proper modules >> though. It's somethin

Re: [GENERAL] xml

2015-03-23 Thread Pavel Stehule
2015-03-23 12:40 GMT+01:00 Ramesh T : > Hi all, > SELECT xmlagg(xmlelement( > name actor, xmlattributes(first_name) > )ORDER BY actor_id,',')from actor; > > the above code return following result, > > [image: Inline image 1] > Questio

Re: [GENERAL] xml

2015-03-23 Thread Pavel Stehule
2015-03-23 15:09 GMT+01:00 Tom Lane : > Pavel Stehule writes: > > result of xmlagg is not valid xml. > > Really? Either that's a bug, or it's declared wrong. > I was not accurate. "" is not valid xml document - and xpath function doens't like it.

Re: [GENERAL] Why doesn't `RAISE EXCEPTION` provide error context?

2015-04-02 Thread Pavel Stehule
2015-04-02 9:13 GMT+02:00 David G. Johnston : > Adding "raw" content present on Nabble that gets filtered by the mailing > list. > > On Wednesday, April 1, 2015, Taytay wrote: > >> We make heavy use of `GET STACKED DIAGNOSTICS` to determine where errors >> happened. >> However, I am trying to use

Re: [GENERAL] Why doesn't `RAISE EXCEPTION` provide error context?

2015-04-02 Thread Pavel Stehule
The OP on this thread has introduced a potential compromise. Keep the > current printing behavior for RAISE but the construction of the error > itself should contain all of the relevant detail so that the caller can get > to the suppressed information via, in this instance, GET STACKED > DIAGNOSTI

Re: [GENERAL] Relation name stored in Postgres

2015-04-02 Thread Pavel Stehule
Hi it is in system catalog - table pg_class, column relname Regards Pavel Stehule 2015-04-02 15:52 GMT+02:00 Ravi Kiran : > Hi, > > I want to know how the relation name is stored in postgres, In which part > of the postgres source code could I find the relation name being store

Re: [GENERAL] Relation name stored in Postgres

2015-04-02 Thread Pavel Stehule
imizer and command execution work with data from pg_class table. I don't understand to second question. if you need some points to postgresql source code - then magic word is "relname" Regards Pavel > > Thank you. > ᐧ > > On Thu, Apr 2, 2015 at 7:32 PM, Pavel

Re: [GENERAL]

2015-04-03 Thread Pavel Stehule
Hi http://stackoverflow.com/questions/4477301/creating-jobs-and-schedules-programatically-with-pgagent regards Pavel Stehule 2015-04-03 11:27 GMT+02:00 Ramesh T : > Hi , > How to create job in pgAgent.Where I need to place script in > pgAgent..any help > > Advanced thanks... > >

Re: [GENERAL] schema or database

2015-04-13 Thread Pavel Stehule
2015-04-13 10:43 GMT+02:00 Albe Laurenz : > Michael Cheung wrote: > > I have many similar database to store data for every customer. > > Structure of database is almost the same. > > As I use same application to control all these data, so I can only use > > one database user to connect to these da

Re: [GENERAL] unexpected error " tables can have at most 1600 columns"

2015-04-13 Thread Pavel Stehule
2015-04-13 17:57 GMT+02:00 Day, David : > Situation > > > > I have a co-developer installing a new Virtual Machine and encountering a > postgres error during the installation. > > One of our SQL patch files is failing unexpectedly. > > > > The patch is attempting to add columns to a table, The t

Re: [GENERAL] schedulers

2015-05-03 Thread Pavel Stehule
2015-05-03 16:40 GMT+02:00 Guillaume Lelarge : > 2015-05-03 16:10 GMT+02:00 Yves Dorfsman : > >> >> I just want to confirm that currently there is no scheduler that isn't >> dependent on a crontab (like PgAgent), that could be run entirely from >> within >> PostgreSQL only. >> >> Anybody knows of

Re: [GENERAL] How to retrieve Comment text using SQL, not psql?

2015-05-30 Thread Pavel Stehule
7;pg_class') as "Description; Regards Pavel Stehule 2015-05-30 13:48 GMT+02:00 Bob Futrelle : > Using pgAdmin3 I've tried this and variations on it. All are rejected. > > select COMMENT ON TABLE articlestats > > > No answer here, > > http://www.postgresql.org/

Re: [GENERAL] PL/pgSQL: How to return two columns and multiple rows

2015-06-18 Thread Pavel Stehule
Hi CREATE OR REPLACE FUNCTION public.fx(i integer, OUT a text, OUT b text) RETURNS SETOF record LANGUAGE plpgsql AS $function$ BEGIN RETURN QUERY SELECT 'foo'||id, 'bar'||id FROM generate_series(1,i) g(id); RETURN; END; $function$ postgres=# SELECT a,b FROM fx(4); ┌──┬──┐ │ a │

Re: [GENERAL] Weird insert issue

2015-06-27 Thread Pavel Stehule
2015-06-28 6:37 GMT+02:00 Larry Meadors : > I'm running this SQL statement: > > insert into Favorite (patronId, titleId) > select 123, 234 > where not exists ( > select 1 from Favorite where patronId = 123 and titleId = 234 > ) > > It normally runs perfectly, but will rarely fail and I just can'

Re: [GENERAL] Weird insert issue

2015-06-27 Thread Pavel Stehule
2015-06-28 6:52 GMT+02:00 Peter Geoghegan : > On Sat, Jun 27, 2015 at 9:47 PM, Pavel Stehule > wrote: > > you can protect it against this issue with locking - in this case you can > > try "for update" clause > > > > http://www.postgresql.org/docs/9.4/sta

Re: [GENERAL] very slow queries and ineffective vacuum

2015-06-30 Thread Pavel Stehule
VACUUM FULL and creating fresh indexes. Autovacuum is based on tracking statistics - you have to see your tables in table pg_stat_user_tables, and you can check there autovacuum timestamp. Sometimes autovacuum has too low priority and it is often cancelled. Regards Pavel Stehule 2015-06-30 14:57 G

Re: [GENERAL] very slow queries and ineffective vacuum

2015-07-02 Thread Pavel Stehule
2015-07-03 7:18 GMT+02:00 Sameer Kumar : > > > On Thu, Jul 2, 2015 at 9:57 PM Lukasz Wrobel < > lukasz.wro...@motorolasolutions.com> wrote: > >> Hello again. >> >> Thank you for all your responses. I will try to clarify more and attempt >> to answer the questions you raised. >> >> I'm attaching th

Re: [GENERAL] Error prone compilation of stored procedure

2015-07-06 Thread Pavel Stehule
2015-07-06 12:08 GMT+02:00 pinker : > What's the reason behind very "tolerant" error checking during stored > procedure compilation? > Why PostgreSQL allows using variable (j_var) that doesn't exists? It isn't > column name or isn't declared anywhere. Like in example below: > > CREATE OR REPLACE F

Re: [GENERAL] Error prone compilation of stored procedure

2015-07-06 Thread Pavel Stehule
2015-07-06 13:52 GMT+02:00 pinker : > Pavel Stehule wrote > > PLpgSQL doesn't check a identifiers inside embedded SQL before execution. > > In this case j_var can be theoretically some SQL identifiers - the > > possibility or impossibility is not know in function valida

Re: [GENERAL] Dynamic multi dimensional arrays in SQL

2015-07-10 Thread Pavel Stehule
,false}} │ └─┘ (1 row) It is one from new features there. In previous versions you can to write own custom aggregate function. Regards Pavel Stehule 2015-07-10 16:52 GMT+02:00 Dane Foster : > Hello, > > I'm trying to dynamically construct a multi dimension

Re: [GENERAL] Index Only Scan vs Cache

2015-07-14 Thread Pavel Stehule
2015-07-14 11:59 GMT+02:00 Shujie Shang : > Does PG has its own data cache? I don't think so. > PG has own data cache - see shared_buffers Regards Pavel > I think PG just using the filesystem cache. > > On Fri, Jul 10, 2015 at 2:06 AM, Andy Colson wrote: > >> On 7/9/2015 12:41 PM, Tom Lane w

Re: [GENERAL] utf8 encoding problem with plperlu

2015-07-15 Thread Pavel Stehule
2015-07-15 20:20 GMT+02:00 Ronald Peterson : > That's interesting. What I'm really doing, instead of the second elog > statement, is this: > > $ret = $ldap->modify( $dn, > replace => { > unicodePwd => $mspass > } ); > > This does wo

Re: [GENERAL] SPI_execute error handling

2015-09-07 Thread Pavel Stehule
2015-09-07 11:04 GMT+02:00 James Harper : > The docs for SPI_execute at > http://www.postgresql.org/docs/9.4/static/spi.html say: > > " > Note that if a command invoked via SPI fails, then control will not be > returned to your procedure. Rather, the transaction or subtransaction in > which your p

Re: [GENERAL] Memory for BYTEA returned by C function is not released until connection is dropped

2015-09-21 Thread Pavel Stehule
2015-09-21 4:31 GMT+02:00 John Leiseboer : > I have written a number of functions in C that return BYTEA type. I have > compiled and run on both Windows and Linux, 32-bit and 64-bit, PostgreSQL > versions 9.3 and 9.4. > > My functions return BYTEA data to the caller. The problem is that memory > u

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Pavel Stehule
2015-09-26 18:17 GMT+02:00 Nikolai Zhubr : > Hi all, > > I'm trying to find a soultion to automatically execute something > (preferrably a function or at least some pure sql statements) at the > beginning and at the end of a user session. As an example, imagine just > storing of all login and logo

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Pavel Stehule
2015-09-26 19:53 GMT+02:00 Nikolai Zhubr : > Hi Pavel, > 26.09.2015 19:26, Pavel Stehule wrote: > [...] > >> This cannot be solved without patching PostgreSQL source code :( . There >> are not good hooks for custom extension. Patch is relative simple, but I >> cann

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Pavel Stehule
2015-09-26 19:59 GMT+02:00 Tom Lane : > Pavel Stehule writes: > > 2015-09-26 19:53 GMT+02:00 Nikolai Zhubr : > >> And the events of session start and session end would seem quite generic > >> and usefull anyway? > > > I don't know. I am pretty scepti

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Pavel Stehule
2015-09-26 20:29 GMT+02:00 Tom Lane : > Pavel Stehule writes: > > 2015-09-26 19:59 GMT+02:00 Tom Lane : > >> A session-start hook is already possible at the C-code level, using > >> session_preload_libraries. It wouldn't be hard to write an extension > >>

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Pavel Stehule
> >> > years ago I tried it, if I remember well. I had a problems with SPI >> calls, >> > because some caches was not initialized. I am not sure, and I didn't >> test >> > last time. >> >> You'd have to start your own transaction if you wanted one, and any >> uncaught error would effectively be FAT

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-27 Thread Pavel Stehule
2015-09-27 13:33 GMT+02:00 Nikolai Zhubr : > Hi, > 27.09.2015 8:29, Pavel Stehule: > >> I'll check it. >> >> >> It is working. Patch attached >> > > Oh, brilliant! This is a _huge_ help actually! > > If I understand it correctly,

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-27 Thread Pavel Stehule
2015-09-27 21:40 GMT+02:00 Jim Nasby : > _PG_fini It should not work - see a doc If the file includes a function named _PG_fini, that function will be called immediately before unloading the file. Likewise, the function receives no parameters and should return void. Note that _PG_fini will only

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-27 Thread Pavel Stehule
2015-09-27 13:33 GMT+02:00 Nikolai Zhubr : > Hi, > 27.09.2015 8:29, Pavel Stehule: > >> I'll check it. >> >> >> It is working. Patch attached >> > > Oh, brilliant! This is a _huge_ help actually! > > If I understand it correctly,

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-27 Thread Pavel Stehule
Hi I stored this extension to github https://github.com/okbob/session_exec Regards Pavel

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-27 Thread Pavel Stehule
2015-09-27 22:51 GMT+02:00 Nikolai Zhubr : > Hi, > 27.09.2015 22:59, Pavel Stehule: > >> >> 2015-09-27 21:40 GMT+02:00 Jim Nasby > <mailto:jim.na...@bluetreble.com>>: >> >> _PG_fini >> >> >> It should not work - see a doc >>

Re: [GENERAL] md5(large_object_id)

2015-10-07 Thread Pavel Stehule
2015-10-07 13:18 GMT+02:00 Karsten Hilbert : > On Wed, Oct 07, 2015 at 12:55:38PM +0200, Karsten Hilbert wrote: > > > > > I am dealing with radiology studies aka DICOM data) one would > > > > want an md5 function which streams in parts of a large object > > > > piece by piece using md5_update and

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Pavel Stehule
2015-10-20 16:45 GMT+02:00 Dane Foster : > Hello, > > I'm in the very very very very early stages of migrating a MySQL/PHP app > to PostgreSQL/PHP/Lua. Because we are moving to PostgreSQL one of the > [many] things I intend to change is to move ALL the SQL code/logic out of > the application layer

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Pavel Stehule
2015-10-20 22:22 GMT+02:00 Dane Foster : > Here is the updated version w/ the feedback incorporated. I'm going to > install PostgreSQL 9.6 from source this weekend so I can start > testing/debugging. Does anyone here have any experience using the pgAdmin > debugger recently? I ask because it seems

Re: [GENERAL] My first PL/pgSQL function

2015-10-21 Thread Pavel Stehule
ably. The bottleneck in PLpgSQL functions are SQL statements usually, and the overhead of "glue" is pretty less. Mainly if you has not any loop there. Regards Pavel > > Thanks, > > Dane > > On Tue, Oct 20, 2015 at 4:37 PM, Pavel Stehule > wrote: > >> &g

Re: [GENERAL] My first PL/pgSQL function

2015-10-21 Thread Pavel Stehule
> ​For posterity here is the final version. I ran it through PostgreSQL > 9.5beta1 this morning so it's at least syntactically valid. Additionally I > went w/ a list of INTO targets instead of a RECORD because it's a more > elegant solution in that it made the code a little less verbose and a > lit

Re: [GENERAL] A question about PL/pgSQL DECLAREd variable behavior

2015-10-23 Thread Pavel Stehule
2015-10-23 18:05 GMT+02:00 Jim Nasby : > On 10/22/15 8:52 PM, Dane Foster wrote: > >> It just occurred to me that another option, for my specific example, >> would be to record/cache FOUND instead of testing the RECORD variable >> for its NULLness. Unless of course assigning FOUND to a variable is

Re: [GENERAL] Unable to select a table as postgres user

2015-10-29 Thread Pavel Stehule
2015-10-30 6:56 GMT+01:00 rajan : > I have a database in which tables are created for each user when they > create > an account. These auto generated tables are used for generating analytics > using a Function. This function is defined as a SECURITY DEFINER. So that > any user who tries to execute

Re: [GENERAL] Unable to select a table as postgres user

2015-10-30 Thread Pavel Stehule
2015-10-30 7:56 GMT+01:00 rajan : > Yes. I agree that the superuser cannot be restricted with any access. > > But my scenarios is, I am executing a function(VOLATILE SECURITY DEFINER) > using the superuser and it function fails with unable to select a > particular > table. > who owns this functio

[GENERAL] Re: [GENERAL] 回复: [GENERAL] ??: postgres cpu 100% need help

2015-11-09 Thread Pavel Stehule
2015-11-08 14:22 GMT+01:00 莎士比亚说: <657985...@qq.com>: > Hi moran and others; > > yesterday i get the pg problem again, and i use perf top Observation > follows: > PerfTop: 11574 irqs/sec kernel: 2.2% exact: 0.0% [4000Hz cycles], > (all, 32 CPUs) > 81.39% postgres [.] s_lock

Re: [GENERAL] Disk I/O Question

2015-11-10 Thread Pavel Stehule
2015-11-10 15:34 GMT+01:00 tbro : > Hello - I am new to this forum and know nothing about PostgreSQL. I have > managed Microsoft SQL for 15 years (I know ) > > We have a third party application that uses PostgreSQL for the database > engine. Performance writing to our Dell Compellent SAN i

Re: [GENERAL] Memory usage per session

2016-07-08 Thread Pavel Stehule
Hi 2016-07-08 15:16 GMT+02:00 : > Hi > > > On 08/07/2016 14:11, amatv...@bitec.ru wrote: > >> Hi. > >> The test performs about 11K lines of code > >> Memory usage per session: > >> Oracle: about 5M > >> MSSqlServer: about 4M > >> postgreSql: about 160М > > > > Visual C??? > > You will have to run

Re: [GENERAL] Memory usage per session

2016-07-08 Thread Pavel Stehule
2016-07-08 17:49 GMT+02:00 : > Hi > > > >> Oracle: about 5M > >> postgreSql: about 160М > > > > >The almost session memory is used for catalog caches. So you should to > have big catalog and long living sessions. > > >What do you do exactly? > > I've generate test code that emulates instruction t

Re: [GENERAL] Strange array_to_table / unnest result

2016-07-14 Thread Pavel Stehule
Hi 2016-07-14 14:55 GMT+02:00 Johann Spies : > When I unnest (regexp_split_to_array) or regexep_split_to_table > > I get one value but the length of the array without the unnest is 193. > > Why would that be? > > wos=# select array_length(regexp_split_to_array(tsv::text, E'\\\s+'),1), > unnest(re

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Pavel Stehule
2016-08-10 15:39 GMT+02:00 Alexander Farber : > > Thank you - > > On Wed, Aug 10, 2016 at 3:18 PM, Charles Clavadetscher < > clavadetsc...@swisspug.org> wrote: > >> >> #variable_conflict [use_column|use_variable] before BEGIN: >> >> - http://dba.stackexchange.com/questions/105831/naming-conflic >>

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Pavel Stehule
2016-08-10 15:42 GMT+02:00 Pavel Stehule : > > > 2016-08-10 15:39 GMT+02:00 Alexander Farber : > >> >> Thank you - >> >> On Wed, Aug 10, 2016 at 3:18 PM, Charles Clavadetscher < >> clavadetsc...@swisspug.org> wrote: >> >>>

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Pavel Stehule
2016-08-10 15:18 GMT+02:00 Charles Clavadetscher : > Hello > > > -Original Message- > > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-owner@ > postgresql.org] On Behalf Of Alexander Farber > > Sent: Mittwoch, 10. August 2016 14:54 > > To: pgsql-general > > Subject: [GENER

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Pavel Stehule
2016-08-10 19:05 GMT+02:00 Alexander Farber : > Thank you Adrian and others - > > I am trying to replace INSERT into temp table in my custom function by > RETURN NEXT, but get an error: > > CREATE OR REPLACE FUNCTION words_check_words( > IN in_uid integer, > IN in_gid integer, >

Re: [GENERAL] Any reasons for 'DO' statement not returning result?

2016-08-16 Thread Pavel Stehule
2016-08-16 21:50 GMT+02:00 Jim Nasby : > On 8/16/16 11:17 AM, Chris Travers wrote: > >> I am thinking adding a temporary keyword to functions would make a lot >> more sense. >> > > Well, right now that's just syntactic sugar, so I think the only real > benefit might be visibility (though, really w

Re: [GENERAL] a column definition list is required for functions returning "record"

2016-08-28 Thread Pavel Stehule
2016-08-29 1:59 GMT+02:00 Jim Nasby : > On 8/26/16 10:32 AM, Alexander Farber wrote: > >> Thank you, I was just wondering if there is a simpler way... but ok >> > > It would be nice if there was a way to pass dynamically formed records > around, similar to how you can pass the results of row() aro

Re: [GENERAL] create roles as normal user

2016-08-28 Thread Pavel Stehule
Hi 2016-08-29 7:14 GMT+02:00 Johannes : > Hello, > > I want a "normal" user to create roles inside the database. > Is it only possible through the createrole privilige, or is there > something like sudo possibile. > > I thought it is possible with the security definer option in create > function,

Re: [GENERAL] RETURNS TABLE function returns nothingness

2016-09-02 Thread Pavel Stehule
2016-09-02 19:21 GMT+02:00 Alexander Farber : > Good evening, > > please help me to figure out, why doesn't this simple test function return > a row with 42, NULL values: > > CREATE OR REPLACE FUNCTION words_merge_users_2( > IN in_users jsonb, > IN in_ip inet >

Re: [GENERAL] IDE for function/stored proc development.

2016-09-03 Thread Pavel Stehule
Hi 2016-09-03 11:36 GMT+02:00 Tim Uckun : > Does anybody use an IDE for doing heavy duty stored proc development? > PGadmin is decent but I am looking for something better. > > I have tried jetbrains with the db browser plugin and on the surface it > seems like a good choice but it's really buggy

Re: [GENERAL] Get date timestamp(3) without time zone column - PGSQL 9.5

2016-09-04 Thread Pavel Stehule
2016-09-05 5:17 GMT+02:00 Patrick B : > >> You might want to share the version of PostgreSQL you are using. >> >> You might want to try date_trunc and AT TIMEZONE function/operators- >> >> https://www.postgresql.org/docs/9.4/static/functions-datetim >> e.html#FUNCTIONS-DATETIME-TRUNC >> >> SELECT

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

2016-09-10 Thread Pavel Stehule
2016-09-11 7:20 GMT+02:00 dandl : > > From: Jim Nasby [mailto:jim.na...@bluetreble.com] > > My guess is this is a test scenario that completely favors VoltDB > > while hamstringing Postgres, such as using no transaction durability > > at all in VoltDB while using maximum durability in Postgres. Co

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

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] 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
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] [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] 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] 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] 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-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] 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] 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] 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] 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] 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] 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] 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

[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

[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

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

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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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 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] 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

  1   2   3   4   5   6   7   8   9   10   >