Re: [GENERAL] Application written in pure pgsql, good idea?

2015-03-02 Thread Merlin Moncure
On Sat, Feb 28, 2015 at 2:39 PM, inspector morse wrote: > > Is it a good idea to write a simple application (consisting of just data > entry interfaces) in pure pgsql? > > Basically, we would have each page has a stored function in postgresql that > is called by php+apache (the http get/post value

Re: [GENERAL] Sharing data between stored functions?

2015-03-05 Thread Merlin Moncure
On Thu, Mar 5, 2015 at 8:58 AM, Igor Neyman wrote: > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of inspector morse > Sent: Thursday, March 05, 2015 9:21 AM > To: pgsql-general@postgresql.org > Subject: [GENERAL] Sharing data between stored func

Re: [GENERAL] Unexpected custom type behavior using ROW(NULL)

2015-03-17 Thread Merlin Moncure
On Sat, Mar 14, 2015 at 7:21 PM, Denver Timothy wrote: > In 9.4.1, I do this: > > CREATE TYPE my_test_type as (part1 text, part2 text); > > \pset null NULL > > WITH test_table(test_col) AS ( > VALUES (NULL::my_test_type), (ROW(NULL, NULL)::my_test_type) > ) > SELECT *, (test_col).part1, (test_

Re: [GENERAL] json-patch support?

2015-03-27 Thread Merlin Moncure
On Fri, Mar 27, 2015 at 1:36 PM, Arthur Silva wrote: > On Fri, Mar 27, 2015 at 1:56 PM, Deven Phillips > wrote: >> >> Are there any plans or ideas about implement JSON Patch >> (http://jsonpatch.com/) support for PostgreSQL? We deal with some relatively >> large JSON documents for our in-house ap

Re: [GENERAL] Muti-table join and roll-up aggregate data into nested JSON?

2015-03-30 Thread Merlin Moncure
On Mon, Mar 30, 2015 at 6:27 AM, Deven Phillips wrote: > I have a multi-table join which will return 1 row per "interface" and I > would like to aggregate the interfaces as a nested section on the resulting > JSON output. Could someone help me to figure out how to accomplish that? > > Example: > >

Re: [GENERAL] JSON "pretty" and selecting nested JSON fields

2015-03-30 Thread Merlin Moncure
On Mon, Mar 30, 2015 at 12:54 PM, Deven Phillips wrote: > Hi all, > > I have a query which selects several rows of data, and contained in one > of those rows is some aggregated JSON data. I am using row_to_json() to make > the whole output JSON and I am providing "true" for pretty formatting o

Re: [GENERAL] Muti-table join and roll-up aggregate data into nested JSON?

2015-03-30 Thread Merlin Moncure
On Mon, Mar 30, 2015 at 4:22 PM, Deven Phillips wrote: > I'm using PostgreSQL 9.4.1 on Ubuntu 14.10. > > The function does the following: > > DROP FUNCTION get_vm_with_interfaces(vm_id BIGINT); > > CREATE OR REPLACE FUNCTION get_virtual_interfaces(vm_id BIGINT) RETURNS > jsonb AS $$ > DECLARE >

Re: [GENERAL] JSON "pretty" and selecting nested JSON fields

2015-03-30 Thread Merlin Moncure
On Mon, Mar 30, 2015 at 3:30 PM, Adrian Klaver wrote: > On 03/30/2015 10:54 AM, Deven Phillips wrote: >> >> Hi all, >> >> I have a query which selects several rows of data, and contained in >> one of those rows is some aggregated JSON data. I am using row_to_json() >> to make the whole output

Re: [GENERAL] "Cast" SRF returning record to a table type?

2015-04-20 Thread Merlin Moncure
On Sat, Apr 18, 2015 at 5:37 PM, Jim Nasby wrote: > On 4/18/15 12:47 AM, David G. Johnston wrote: >> >> If you could find a way to pass a value of type some_table into the >> function - instead of the name/text 'some_table‘ - you could possibly >> use polymorphic pseudotypes...just imagining here

Re: [GENERAL] "Cast" SRF returning record to a table type?

2015-04-20 Thread Merlin Moncure
On Mon, Apr 20, 2015 at 11:40 AM, David G. Johnston wrote: > On Mon, Apr 20, 2015 at 7:57 AM, Merlin Moncure wrote: >> >> On Sat, Apr 18, 2015 at 5:37 PM, Jim Nasby >> wrote: >> > On 4/18/15 12:47 AM, David G. Johnston wrote: >> >> >> &g

Re: [GENERAL] delete is getting hung when there is a huge data in table

2015-05-06 Thread Merlin Moncure
On Wed, May 6, 2015 at 1:56 AM, Mitu Verma wrote: > Thank you so much all of you. > > Table audittraillogentry have PRIMARY KEY and FOREIGN KEY defined, below is > the detail of existing table audittraillogentry. > > As you can see ., it is referenced by 2 tables , "cdrdetails" and > "cdrlogentr

[GENERAL] really nice article about postgres popularity in startups on techrepublic

2015-05-26 Thread Merlin Moncure
have a read: http://www.techrepublic.com/article/postgres-pushes-past-mysql-in-developer-hearts/ merlin -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

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

2015-06-18 Thread Merlin Moncure
On Thu, Jun 18, 2015 at 7:50 AM, Chris Travers wrote: > > On Thu, Jun 18, 2015, 14:38 Sven Geggus wrote: > > Hello, > > I supose this is simple, but I did not find a solution in the documentation. > > Because you already are returning 2 columns. > > I would like to be able to do something like th

Re: [GENERAL] native api or odbc?

2015-06-24 Thread Merlin Moncure
On Tue, Jun 23, 2015 at 5:56 PM, Ted Toth wrote: > What are peoples experiences with either/both, pluses/minuses? If you're coding at the C level, I would definitely choose libpq unless you were worried about cross database portability. libpq is a bit clunky but easy to code against. libpq is

Re: [GENERAL] Correct place for feature requests

2015-06-29 Thread Merlin Moncure
On Thu, Jun 25, 2015 at 1:59 PM, Алексей Бережняк wrote: > I think that PostgreSQL is great RDBMS, but one important (for me) > feature that it missing is case-insensitive identifier quotes > ([table].[column]) like in Microsoft SQL Server. > > I know that there are double quotes, but they are cas

Re: [GENERAL] How to speed up pg_trgm / gin index scan

2015-07-28 Thread Merlin Moncure
On Tue, Jul 28, 2015 at 8:34 AM, Christian Ramseyer wrote: > On 22/06/15 13:51, Christian Ramseyer wrote: >> Hi >> >> I have a pretty large table with syslog messages. >> >> It is already partitioned by month, and for a single month I have e.g. >> >> >> DM=# \d+ logs_01 >> >> Column|

Re: [GENERAL] [ADMIN] How Many PG_Locks are considered too many

2015-07-30 Thread Merlin Moncure
On Thu, Jul 30, 2015 at 9:19 AM, John Scalia wrote: > Seconding Peter on this one; it's a lot more important should one of those > locks be hanging around, say for hours or days, not how many have come and > gone. Also, it's good to focus on *ungranted* locks. Typically the only time I care abo

[GENERAL] PSA: linux kernel bug in TRIM support corrupts data with md raid levels 0 and 10

2015-07-30 Thread Merlin Moncure
http://www.spinics.net/lists/raid/msg49452.html (via slashdot) merlin -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Preparing statement using PQexec vs PQprepare

2015-08-20 Thread Merlin Moncure
On Wed, Aug 19, 2015 at 5:55 AM, tonymark09 wrote: > Hello, > > Is preparing a statement using PQexec and executing it is much slower that > using other API such as PQprepare and PQexecPrepared? PQexec can be faster than a combination of PQprepare and PQexecPrepared particularly if you only need

Re: [GENERAL] Why this lock?

2015-08-25 Thread Merlin Moncure
On Tue, Aug 25, 2015 at 8:33 AM, Johann Spies wrote: > I have a long-running query (running now for more than 6 days already > (process 17434). It involves three tables of which one contains XML-data. > > On another, unrelated table with 30718567 records, I ran a query to create > an index on a

Re: [GENERAL] Grouping sets, cube and rollup

2015-08-26 Thread Merlin Moncure
On Tue, Aug 25, 2015 at 7:04 PM, Edson Richter wrote: > Any chance to get those amazing wonderful features backported to 9.4? you might have some luck merging in the feature yourself if you're so inclined. merlin -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make ch

Re: [GENERAL] LATERAL query extreme slow due to partition

2015-09-08 Thread Merlin Moncure
On Mon, Sep 7, 2015 at 12:07 AM, Tom Smith wrote: > Hi: > > I am using the wonderful lateral query feature like the following > > select * from generate_series (1,10,5) T(t), >lateral (select * from P where t between t and t + 3) > > P is a parent table of a hundred partitions > the id

Re: [GENERAL] LATERAL query extreme slow due to partition

2015-09-08 Thread Merlin Moncure
On Tue, Sep 8, 2015 at 3:24 PM, Tom Smith wrote: > On Tue, Sep 8, 2015 at 3:51 PM, Merlin Moncure wrote: >> On Mon, Sep 7, 2015 at 12:07 AM, Tom Smith >> > How to force query planner "dynamically" generate plan to >> > for each lateral select query as "

Re: [GENERAL] Buffers: shared hit/read to shared_buffers dependence

2015-09-08 Thread Merlin Moncure
On Sat, Sep 5, 2015 at 3:28 PM, Albe Laurenz wrote: > Pavel Suderevsky wrote: >> When I have been passing through "Understanding explain" manual >> (http://www.dalibo.org/_media/understanding_explain.pdf) >> I've faced some strange situation when table with size of 65MB completely >> placed in c

Re: [GENERAL] OR vs UNION vs UNION ALL

2015-09-23 Thread Merlin Moncure
On Wed, Sep 23, 2015 at 8:38 AM, Etienne Champetier wrote: > Two questions: > 1) Is it normal to have such a big difference between OR and UNION and > should i always prefer UNION when possible? yes, it's unfortunate but true. I consider automatic transformation of these expressions to possible

Re: [GENERAL] Understanding "seq scans"

2015-10-12 Thread Merlin Moncure
On Monday, October 12, 2015, Lele Gaifax wrote: > Adrian Klaver > writes: > > > Off hand I would say it is because of this --> count(m.num). Try > count(l.num) instead and see > > what happens. As your queries above show they are the same number. > > No, that's another thing I already tried tweak

Re: [GENERAL] Understanding "seq scans"

2015-10-14 Thread Merlin Moncure
On Tue, Oct 13, 2015 at 11:54 AM, Alvaro Herrera wrote: > Lele Gaifax wrote: >> Alvaro Herrera writes: >> >> > So 10% of your rows in the master_l10n table start with "quattro"? >> > That's pretty odd, isn't it? How did you manufacture these data? >> >> Well, not a real scenario for sure, but de

Re: [GENERAL] RAID and SSD configuration question

2015-10-20 Thread Merlin Moncure
On Tue, Oct 20, 2015 at 3:14 AM, Birta Levente wrote: > Hi > > I have a supermicro SYS-1028R-MCTR, LSI3108 integrated with SuperCap module > (BTR-TFM8G-LSICVM02) > - 2x300GB 10k spin drive, as raid 1 (OS) > - 2x300GB 15k spin drive, as raid 1 (for xlog) > - 2x200GB Intel DC S3710 SSD (for DB), as

Re: [GENERAL] RAID and SSD configuration question

2015-10-20 Thread Merlin Moncure
On Tue, Oct 20, 2015 at 10:14 AM, Tomas Vondra wrote: > Hi, > > On 10/20/2015 03:30 PM, Merlin Moncure wrote: >> >> On Tue, Oct 20, 2015 at 3:14 AM, Birta Levente >> wrote: >>> >>> Hi >>> >>> I have a supermicro SYS-1028R-MCTR, LSI3

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Merlin Moncure
On Tue, Oct 20, 2015 at 9:45 AM, Dane Foster wrote: > 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 > applic

Re: [GENERAL] RAID and SSD configuration question

2015-10-20 Thread Merlin Moncure
On Tue, Oct 20, 2015 at 12:28 PM, Scott Marlowe wrote: >> On Tue, Oct 20, 2015 at 9:33 AM, Scott Marlowe >> wrote: >>> We're running LSI MegaRAIDs at work with 10 SSD RAID-5 arrays, and we >>> can get ~5k to 7k tps on a -s 1 pgbench with the write cache on. >>> >>> When we turn the write cac

Re: [GENERAL] My first PL/pgSQL function

2015-10-21 Thread Merlin Moncure
On Wed, Oct 21, 2015 at 10:24 AM, Dane Foster wrote: > 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 th

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

2015-10-27 Thread Merlin Moncure
On Tue, Oct 27, 2015 at 12:14 PM, Bill Moran wrote: > On Tue, 27 Oct 2015 11:30:45 +0800 > "657985...@qq.com" <657985...@qq.com> wrote: > >> Dear sir: >> Recently a wired question about postgresql database really bothered >> me a lot, so i really need your help. Here is the problem, in t

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

2015-10-27 Thread Merlin Moncure
On Tue, Oct 27, 2015 at 2:33 PM, Jeff Janes wrote: > On Mon, Oct 26, 2015 at 8:30 PM, 657985...@qq.com <657985...@qq.com> wrote: >> >> Dear sir: >> Recently a wired question about postgresql database really >> bothered me a lot, so i really need your help. Here is the problem, in the >> m

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

2015-10-27 Thread Merlin Moncure
On Tue, Oct 27, 2015 at 4:04 PM, Merlin Moncure wrote: > On Tue, Oct 27, 2015 at 2:33 PM, Jeff Janes wrote: >> On Mon, Oct 26, 2015 at 8:30 PM, 657985...@qq.com <657985...@qq.com> wrote: >>> >>> Dear sir: >>> Recently a wired question about po

Re: [GENERAL] Approach to extract top records from table based upon aggregate

2015-11-03 Thread Merlin Moncure
On Mon, Nov 2, 2015 at 4:14 PM, droberts wrote: > Hi, I have a table that contains call records. I'm looking to get only > records for users who made the most calls over a particular time duration in > an efficient way. > > calls() > > time, duration, caller_number, dialed_number > > > > -- qu

Re: [GENERAL] How to search a string inside a json structure

2015-11-03 Thread Merlin Moncure
On Tue, Nov 3, 2015 at 9:57 AM, Vick Khera wrote: > > On Tue, Nov 3, 2015 at 10:07 AM, Sami Pietilä > wrote: >> >> Unfortunately I could not figure out how to select rows which, for >> example, contain following json: '{"a":"world","c":{"b":"helloworld"}}' by >> search with "hello" string. > > ca

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

2015-11-10 Thread Merlin Moncure
On Sun, Nov 8, 2015 at 7:22 AM, 莎士比亚说: <657985...@qq.com> wrote: > 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 [.

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

2015-11-10 Thread Merlin Moncure
On Tue, Nov 10, 2015 at 8:26 AM, Merlin Moncure wrote: > On Sun, Nov 8, 2015 at 7:22 AM, 莎士比亚说: <657985...@qq.com> wrote: >> Hi moran and others; >> >> yesterday i get the pg problem again, and i use perf top Observation >> follows: >> PerfTop: 11

Re: [GENERAL] recursive table performance (CTE)

2015-11-12 Thread Merlin Moncure
On Wed, Nov 11, 2015 at 3:44 AM, Dusan wrote: > Hi, > I'm using table with parent_id to themselve and WITH RECURSIVE in SELECT on > about 3thousands records. > The "tree" of data is wide (each node has more children) but not deep > (maximal depth of branch is 10 nodes). > > I'm planning to use sam

Re: [GENERAL] Best tool to pull from mssql

2015-11-12 Thread Merlin Moncure
On Tue, Nov 10, 2015 at 12:26 PM, Adrian Klaver wrote: > On 11/10/2015 10:21 AM, Mammarelli, Joanne T wrote: >> >> Hi .. we’re on a hunt to locate either pgloader or the tds_fdw extension >> to assist us with pulling data FROM a Microsoft sql server (we’re a >> windows-based postgres installation)

Re: [GENERAL] Array_to_json remove brackets

2015-11-13 Thread Merlin Moncure
On Fri, Nov 13, 2015 at 7:20 AM, Leonardo M. Ramé wrote: > Hi, is there a way to get an array converted to json without brackets?. > > I'm getting, for example [{"field": "value"}, {"field": "value"}] and I want > to get this: {"field": "value"}, {"field": "value"}. please supply an example. Als

Re: [GENERAL] RowDescription via the SQL?

2016-06-02 Thread Merlin Moncure
On Thu, Jun 2, 2016 at 1:14 AM, Dmitry Igrishin wrote: > Hi, > > It's possible to query pg_prepared_statements view to obtain the > information about > parameters used in the statement that was prepared. But I don't found > how to get the > information about the rows that will be returned when the

Re: [GENERAL] psql remote shell command

2016-06-03 Thread Merlin Moncure
On Thu, Jun 2, 2016 at 6:54 PM, Michael Paquier wrote: > On Fri, Jun 3, 2016 at 8:48 AM, David G. Johnston > wrote: >> On Thu, Jun 2, 2016 at 7:39 PM, Michael Paquier >> wrote: >> I was focused on admin task due to the pg_ctl (not sure you'd want to run >> that via psql...) but if you have shell

Re: [GENERAL] random huge delay when recreate a VIEW or FUNCTION

2016-06-17 Thread Merlin Moncure
On Tue, Jun 14, 2016 at 4:59 PM, Catalin Maftei wrote: > when I recreate a VIEW or FUNCTION with a small change I get: > > Query returned successfully with no result in 03:58 minutes. This is almost certainly due to locks. Next time this happens, query pg_stat_activity and pg_locks -- the inform

Re: ***SPAM*** Re: [GENERAL] random huge delay when recreate a VIEW or FUNCTION

2016-06-17 Thread Merlin Moncure
On Thu, Jun 16, 2016 at 6:55 PM, Melvin Davidson wrote: You have not provided information as to the O/S of the PostgreSQL server or your PgAdmin remote system (I suspect Windows), but regardless, you > are just asking for trouble by doing development over a remote connection. > You should verify

Re: [GENERAL] Stored procedure version control

2016-06-30 Thread Merlin Moncure
On Wed, Jun 29, 2016 at 1:46 PM, Neil Anderson wrote: > On 2016-06-29 12:37 PM, Mark Morgan Lloyd wrote: >> >> Elsewhere, somebody was asking how people implemented version control >> for stored procedures on (MS) SQL Server. >> >> The consensus was that this is probably best managed by using scri

Re: [GENERAL] PSQL does not remove obvious useless joins

2016-07-01 Thread Merlin Moncure
On Fri, Jul 1, 2016 at 12:17 PM, Sfiligoi, Igor wrote: > Hello. > > We have a view that is very generic, and we noticed that PostgreSQL is not > very good at removing useless joins, which makes our queries very slow. > > We could change our code to avoid the view and write ad-hoc queries to the >

Re: [GENERAL] Fastest memmove in C

2016-07-07 Thread Merlin Moncure
On Thu, Jul 7, 2016 at 6:12 AM, FarjadFarid(ChkNet) wrote: > > > Hi Álvaro, > > Based on the article. This research has been tested with various hardware. > The code automatically detects the hardware and based on the size of memory > to be copied it will choose one of 3 routines. > > Regarding li

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Merlin Moncure
On Thu, Jul 7, 2016 at 1:18 PM, Alvaro Herrera wrote: > Tom Lane wrote: > >> You might have better luck with "psql -n", or maybe not. > > I've wished sometimes for a "\set READLINE off" psql metacommand for > this kind of thing. It's pretty annoying when the text being pasted > contains tabs and

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Merlin Moncure
On Thu, Jul 7, 2016 at 2:48 PM, Alvaro Herrera wrote: > Merlin Moncure wrote: >> On Thu, Jul 7, 2016 at 1:18 PM, Alvaro Herrera >> wrote: >> > Tom Lane wrote: >> > >> >> You might have better luck with "psql -n", or maybe not. >>

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

2016-08-11 Thread Merlin Moncure
On Mon, Aug 8, 2016 at 7:25 PM, Xtra Coder wrote: > Hi, > > I'm just curious about the reasons of the design of 'DO' statement so that > it is not able to return result of the SELECT in its body. > > References: > https://www.postgresql.org/docs/current/static/sql-do.html > > http://stackoverf

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

2016-08-16 Thread Merlin Moncure
pe variables, 'DO' is just >> not needed after that >> - SELECTs not targeted into a variable - are written to client output >> - (C) Merlin Moncure - "Ability to embed collection of statements in the >> database under a name and invoke those statements via CAL

Re: [GENERAL] Jsonb extraction very slow

2016-08-16 Thread Merlin Moncure
On Thu, Aug 11, 2016 at 8:45 AM, Tom Lane wrote: > Jim Nasby writes: >> I never dug into why. As Tom posited, decompression might explain the >> time to get a single key out. Getting 10 keys instead of just 1 wasn't >> 10x more expensive, but it was significantly more expensive than just >> getti

Re: [GENERAL] PG vs ElasticSearch for Logs

2016-08-19 Thread Merlin Moncure
On Fri, Aug 19, 2016 at 2:32 AM, Thomas Güttler wrote: > I want to store logs in a simple table. > > Here my columns: > > Primary-key (auto generated) > timestamp > host > service-on-host > loglevel > msg > json (optional) > > I am unsure which DB to choose: Postgres, ElasticSearch o

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

2016-08-26 Thread Merlin Moncure
On Fri, Aug 26, 2016 at 10:50 AM, Cachique wrote: > Hi > From the documentation... ( > https://www.postgresql.org/docs/current/static/sql-select.html ) > > 'Function calls can appear in the FROM clause. (This is especially useful > for functions that return result sets, but any function can be use

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

2016-08-29 Thread Merlin Moncure
On Mon, Aug 29, 2016 at 6:28 AM, Tom Lane wrote: > Pavel Stehule writes: >> 2016-08-29 1:59 GMT+02:00 Jim Nasby : >>> 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() around. Someone >>> else has actually be asking

Re: [GENERAL] How to retrieve jsonb column through JDBC

2016-08-29 Thread Merlin Moncure
On Sat, Aug 27, 2016 at 5:39 AM, Alexander Farber wrote: > Hello, > > what do you use to retrieve a jsonb column using JDBC? > > I have tried > > Object last_tiles = rs.getObject("last_tiles"); > > and the resulting Object seems to be a String. > > Then I have called (using Jetty JSON clas

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

2016-09-07 Thread Merlin Moncure
Fri, Sep 2, 2016 at 6:55 PM, Jim Nasby wrote: > On 8/29/16 6:28 AM, Tom Lane wrote: >> >> Pavel Stehule writes: >>> >>> > 2016-08-29 1:59 GMT+02:00 Jim Nasby : >> It would be nice if there was a way to pass dynamically formed >> records >> around, similar to how you can pass

Re: [GENERAL] PostgreSQL Database performance

2016-09-07 Thread Merlin Moncure
On Tue, Sep 6, 2016 at 11:12 PM, Pradeep wrote: > Dear Naveed, > > I am using PostgreSQL 9.3 version on Windows .After changing these > parameters, I have not seen any resource management utilization. > > I have observed before and after changing the parameter values ,it is not > reflecting the m

Re: [GENERAL] Is there a way to fix this ugliness

2016-09-09 Thread Merlin Moncure
On Fri, Sep 9, 2016 at 8:30 AM, Tim Uckun wrote: > I am trying to get the child elements of a one to many table to be rolled up > into a json field in the parent table. The query I am running is > > select > ob.id > ,case when array_position(array_agg(im.image_type), null) = 1 then > '[]

Re: [GENERAL] Predicting query runtime

2016-09-12 Thread Merlin Moncure
On Mon, Sep 12, 2016 at 9:03 AM, Vinicius Segalin wrote: > Hi everyone, > > I'm trying to find a way to predict query runtime (I don't need to be > extremely precise). I've been reading some papers about it, and people are > using machine learning to do so. For the feature vector, they use what th

Re: [GENERAL] BRIN indexes and ORDER BY

2016-10-06 Thread Merlin Moncure
On Wed, Oct 5, 2016 at 3:27 PM, Stephen Frost wrote: > Darren, > > * Darren Lafreniere (dlafreni...@onezero.com) wrote: >> Tom Lane wrote: >> > > Gavin Wahl wrote: >> > >> It seems trivial to accelerate a MAX or MIN query with a BRIN index. You >> > >> just find the page range with the largest/sm

Re: [GENERAL] Lock contention in TransactionIdIsInProgress()

2016-10-07 Thread Merlin Moncure
On Wed, Oct 5, 2016 at 5:38 AM, Tomáš Uko wrote: > Hi Jeff, > > > > We have encountered same problem as you (in 9.5.4), it seems that so far it > hasn’t been ported back from 9.6, but if you take this commit and apply it > to 9.5 source codes, it seems to be working > > But anyway, does anybody kn

Re: [GENERAL] Transactional-DDL DROP/CREATE TABLE

2016-10-10 Thread Merlin Moncure
On Thu, Oct 6, 2016 at 4:21 AM, Geoff Winkless wrote: > Hi > > I have code that does (inside a single transaction) > > DROP TABLE IF EXISTS mytable; CREATE TABLE mytable > > Occasionally this produces > > ERROR: duplicate key value violates unique constraint > "pg_type_typname_nsp_index" DETA

Re: [GENERAL] custom average window function failure

2016-10-10 Thread Merlin Moncure
On Sun, Oct 9, 2016 at 10:10 PM, Sebastian P. Luque wrote: > On Sun, 09 Oct 2016 16:00:21 -0400, > Tom Lane wrote: > >> "Sebastian P. Luque" writes: >>> Tom Lane wrote: On closer inspection, the error is only in the aggregate-used-as-window-function case, not plain aggregation. > >>>

Re: [GENERAL] json rendering without pretty option (compact)

2016-10-19 Thread Merlin Moncure
On Tue, Oct 18, 2016 at 12:00 PM, Nicolas Paris wrote: > Hello, > > I want to minimize postgresql json size when I fetch them. > I translate columnar table to json thought json_build_object/array or even > row_to_jeon. > > While row_to_json do have a "pretty_bool" option, the latter do not. Each >

Re: [GENERAL] libpq heartbeat

2016-10-27 Thread Merlin Moncure
On Thu, Oct 27, 2016 at 10:01 AM, Francisco Olarte wrote: > And I'd like to point libpq sessions does not sound to be the best > kind of traffic across a firewall, not a good service / protocol to > expose. meh -- it's perfectly fine to expose postgres to the internet as long as you've handled th

Re: [GENERAL] libpq heartbeat

2016-10-27 Thread Merlin Moncure
On Thu, Oct 27, 2016 at 11:18 AM, Francisco Olarte wrote: > Merlin: > > On Thu, Oct 27, 2016 at 6:10 PM, Merlin Moncure wrote: >> On Thu, Oct 27, 2016 at 10:01 AM, Francisco Olarte >> wrote: >>> And I'd like to point libpq sessions does not sound to be th

Re: [GENERAL] libpq heartbeat

2016-10-27 Thread Merlin Moncure
On Thu, Oct 27, 2016 at 12:45 PM, Francisco Olarte wrote: > Merlin: > > On Thu, Oct 27, 2016 at 7:29 PM, Merlin Moncure wrote: >> On Thu, Oct 27, 2016 at 11:18 AM, Francisco Olarte >> wrote: >>> It is, but handling them is not easy, and you have to deal with thi

Re: [GENERAL] How to hint 2 coulms IS NOT DISTINCT FROM each other

2016-10-28 Thread Merlin Moncure
On Fri, Oct 28, 2016 at 1:17 PM, Tom Lane wrote: > Scott Marlowe writes: >> On Fri, Oct 28, 2016 at 10:29 AM, Kim Rose Carlsen wrote: >>> I was wondering if there is a way to hint that two columns in two different >>> tables IS NOT DISTINCT FROM each other. So that the optimizer may assume if >>

Re: [GENERAL] How to hint 2 coulms IS NOT DISTINCT FROM each other

2016-10-28 Thread Merlin Moncure
On Fri, Oct 28, 2016 at 1:20 PM, Merlin Moncure wrote: > On Fri, Oct 28, 2016 at 1:17 PM, Tom Lane wrote: >> Scott Marlowe writes: >>> On Fri, Oct 28, 2016 at 10:29 AM, Kim Rose Carlsen wrote: >>>> I was wondering if there is a way to hint that two columns in tw

Re: [GENERAL] How to hint 2 coulms IS NOT DISTINCT FROM each other

2016-10-28 Thread Merlin Moncure
On Fri, Oct 28, 2016 at 2:54 PM, Kim Rose Carlsen wrote: >> > On Fri, Oct 28, 2016 at 10:29 AM, Kim Rose Carlsen wrote: > >> > Hi >> > >> > I was wondering if there is a way to hint that two columns in two >> > different >> > tables IS NOT DISTINCT FROM each other. So that the optimizer may assum

Re: [GENERAL] How to hint 2 coulms IS NOT DISTINCT FROM each other

2016-10-31 Thread Merlin Moncure
On Sat, Oct 29, 2016 at 8:27 AM, Kim Rose Carlsen wrote: >>> This doesn't do much good. This doesn't tell the planner that the 3 > >>> customer_ids are actually of same value, and it therefore can't filter >>> them >>> as it sees fit. > >> You do know you can index on a function, and the planner t

Re: [GENERAL] How to hint 2 coulms IS NOT DISTINCT FROM each other

2016-11-01 Thread Merlin Moncure
On Mon, Oct 31, 2016 at 9:28 AM, Kim Rose Carlsen wrote: > On Sat, Oct 29, 2016 at 8:27 AM, Kim Rose Carlsen wrote: > >> > I have tried creating a function called >> > zero_if_null(int) : int that just select COALESCE($1, 0) >> > and adding a index on (zero_if_null(customer_id)) on table that con

Re: [GENERAL] How to hint 2 coulms IS NOT DISTINCT FROM each other

2016-11-04 Thread Merlin Moncure
On Fri, Nov 4, 2016 at 8:08 AM, Kim Rose Carlsen wrote: >>> It might raise another problem, that the nulls are generated through LEFT > >>> JOINS where no rows are defined. Then the 0 or -1 value need to be >>> a computed value. Won't this throw off index lookups? (I might be >>> more confused in

Re: [GENERAL] How to hint 2 coulms IS NOT DISTINCT FROM each other

2016-11-07 Thread Merlin Moncure
On Fri, Nov 4, 2016 at 9:38 AM, Alban Hertroys wrote: > On 4 November 2016 at 14:41, Merlin Moncure wrote: >> On Fri, Nov 4, 2016 at 8:08 AM, Kim Rose Carlsen wrote: >>> The nulls are generated by something like this >>> SELECT c.circuit_id, >>&g

Re: [GENERAL] Change column type from int to bigint - quickest way

2016-11-11 Thread Merlin Moncure
On Friday, November 11, 2016, Andreas Brandl wrote: > Hi, > > we have a pretty big table with an integer-type primary key. I'm looking > for the quickest way to change the column type to bigint to avoid hitting > the integer limit. We're trying to avoid prolonged lock situations and full > table

Re: [GENERAL] Change column type from int to bigint - quickest way

2016-11-16 Thread Merlin Moncure
On Fri, Nov 11, 2016 at 9:30 AM, Andreas Brandl wrote: > Hi, > > we have a pretty big table with an integer-type primary key. I'm looking for > the quickest way to change the column type to bigint to avoid hitting the > integer limit. We're trying to avoid prolonged lock situations and full tabl

Re: [GENERAL] "Fuzzy" Matches on Nicknames

2016-11-30 Thread Merlin Moncure
On Tue, Nov 29, 2016 at 6:56 PM, rob stone wrote: > Hello Michael, > On Tue, 2016-11-29 at 19:10 -0500, Michael Sheaver wrote: >> Greetings, >> >> I have two tables that are populated using large datasets from >> disparate external systems, and I am trying to match records by >> customer name betw

Re: [GENERAL] About the MONEY type

2016-11-30 Thread Merlin Moncure
On Wed, Nov 30, 2016 at 7:43 AM, Raymond O'Donnell wrote: > On 30/11/16 12:05, Thomas Kellerer wrote: >> >> Tobia Conforto schrieb am 30.11.2016 um 12:15: >>> >>> I think MONEY is a great datatype, at least in theory. >> >> >> I personally find it pretty useless to be honest - especially because >

Re: [GENERAL] Index is not used for "IN (non-correlated subquery)"

2016-11-30 Thread Merlin Moncure
On Wed, Nov 30, 2016 at 10:42 AM, Tom Lane wrote: > George writes: >> explain select * from wg3ppbm_transaction where partner_uuid in ( >> select p.uuid >> from wg3ppbm_userpartner up >> join wg3ppbm_partner p on p.id = up.partner_id >> ); > >> "Hash Semi Join

Re: [GENERAL] Index is not used for "IN (non-correlated subquery)"

2016-11-30 Thread Merlin Moncure
On Wed, Nov 30, 2016 at 11:05 AM, George wrote: > On Wed, Nov 30, 2016 at 6:45 PM, Merlin Moncure wrote: >> On Wed, Nov 30, 2016 at 10:42 AM, Tom Lane wrote: >>> George writes: >>>> explain select * from wg3ppbm_transaction where partner_uuid in (

Re: [GENERAL] select function alias

2016-11-30 Thread Merlin Moncure
On Wed, Nov 30, 2016 at 12:15 PM, David G. Johnston wrote: > On Wed, Nov 30, 2016 at 8:15 AM, bto...@computer.org > wrote: >> >> 5. Use a CTE: >> >> with shortnames as ( >> select to_char(impressions_create_date,'-mm-dd') as ymd from >> impressionsdb >> ) select ymd from shortname

Re: [GENERAL] About the MONEY type

2016-11-30 Thread Merlin Moncure
On Wed, Nov 30, 2016 at 2:16 PM, John McKown wrote: > On Wed, Nov 30, 2016 at 1:23 PM, bto...@computer.org > wrote: > Speaking generically, I guess maybe MONEY needs to be somewhat like a > TIMESTAMP. At least in PostgreSQL, a TIMESTAMP can contain a TIMEZONE. I > guess a MONEY type should contai

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

2016-12-09 Thread Merlin Moncure
On Wed, Dec 7, 2016 at 9:57 AM, Rich Shepard wrote: > 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? Main advantage of COMMENT is that t

Re: [GENERAL] storing C binary array in bytea via libpq

2016-12-09 Thread Merlin Moncure
On Wed, Dec 7, 2016 at 4:10 AM, Tom DalPozzo wrote: > Hi, > I tried both ways: they're ok. > Also, multiple VALUES in one INSERT is actually better as performance. If you are chasing performance with the binary protocol you might want to take a look at libpqtypes: http://libpqtypes.esilo.com/ It

Re: [GENERAL] Performance PLV8 vs PLPGSQL

2017-01-04 Thread Merlin Moncure
On Wed, Dec 28, 2016 at 3:15 AM, Tim Uckun wrote: > 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? > > Is there any benefit to choo

Re: [GENERAL] Row value expression much faster than equivalent OR clauses

2017-01-05 Thread Merlin Moncure
On Wed, Jan 4, 2017 at 8:49 AM, Kevin Grittner wrote: > On Wed, Dec 28, 2016 at 10:58 AM, Steven Grimm wrote: > >> WHERE ((e.timeStamp > '2016-12-19T20:34:22.315Z') >> OR (e.timeStamp = '2016-12-19T20:34:22.315Z' >> AND e.sequenceNumber > 0) >> OR (e.timeStamp = '2016-

Re: [GENERAL] PostgreSQL not reusing free space in table ?

2017-01-06 Thread Merlin Moncure
On Fri, Jan 6, 2017 at 4:09 AM, Pierre Ducroquet wrote: > Hi > > Running PostgreSQL 9.4, I am running in the following issue. > On a huge table, I have to remove the content (set to '') of a column that > makes for 99% of the weight of the table. Since the production can not be > stopped, I will n

Re: [GENERAL] Write-optimized data structures

2017-01-06 Thread Merlin Moncure
On Thu, Dec 29, 2016 at 4:03 PM, selforganized wrote: > Hi, > > Does Postgresql have any write-optimized data structure like LSM-tree? if > not is there any plan to implement that? > > I'm building a write-heavy OLTP application. I'm looking at write-optimized > databases like MyRocks, TokuDB, and

Re: [GENERAL] Queries on very big table

2017-01-06 Thread Merlin Moncure
On Mon, Jan 2, 2017 at 5:23 AM, Job wrote: > Hello guys and very good new year to everybody! > > We are now approaching some queries and statistics on very big table (about > 180 millions of record). > The table is partitioned by day (about ~3 Gb of data for every partition/day). > We use Postgre

Re: [GENERAL] efficiently migrating 'old' data from one table to another

2017-01-12 Thread Merlin Moncure
On Thu, Jan 12, 2017 at 2:19 PM, bto...@computer.org wrote: > > > - Original Message - >> From: "Jonathan Vanasco" >> To: "pgsql-general general" >> Sent: Thursday, January 12, 2017 3:06:14 PM >> Subject: [GENERAL] efficiently migrating 'old' data from one table to another >> >> I'm just

Re: [GENERAL] efficiently migrating 'old' data from one table to another

2017-01-13 Thread Merlin Moncure
On Fri, Jan 13, 2017 at 12:03 PM, wrote: > On Jan 12, 2017, Jonathan Vanasco wrote: >>On Jan 12, 2017, at 5:52 PM, Merlin Moncure wrote: >> >>> On Thu, Jan 12, 2017 at 2:19 PM, bto...@computer.org >>> wrote: >>>> >>>> Revie

Re: [GENERAL] Queries are taking way longer in 9.6 than 9.5

2017-01-18 Thread Merlin Moncure
On Wed, Jan 18, 2017 at 1:04 PM, Ravi Tammineni wrote: > Hi Chris, > > Here is the query and execution plan in 9.5 and 9.6. Can you verify tblpuorderstatus and tblpuorderstatushistory have all indexes accounted for on both servers? It seems incredible server would prefer wading through 11M recor

Re: [GENERAL] Queries are taking way longer in 9.6 than 9.5

2017-01-18 Thread Merlin Moncure
On Wed, Jan 18, 2017 at 2:12 PM, Melvin Davidson wrote: > > > On Wed, Jan 18, 2017 at 3:06 PM, Merlin Moncure > wrote: > >> On Wed, Jan 18, 2017 at 1:04 PM, Ravi Tammineni >> wrote: >> > Hi Chris, >> > >> > Here is the query a

Re: [GENERAL] Queries are taking way longer in 9.6 than 9.5

2017-01-18 Thread Merlin Moncure
On Wed, Jan 18, 2017 at 11:10 PM, Adrian Klaver wrote: > On 01/18/2017 08:58 PM, Merlin Moncure wrote: >> >> On Wed, Jan 18, 2017 at 2:12 PM, Melvin Davidson > <mailto:melvin6...@gmail.com>> wrote: >> >> >> >> On Wed, Jan 18, 2017 at 3:06

Re: [GENERAL] Queries are taking way longer in 9.6 than 9.5

2017-01-19 Thread Merlin Moncure
On Thu, Jan 19, 2017 at 1:28 AM, Tomas Vondra wrote: > On 01/19/2017 06:21 AM, Merlin Moncure wrote: >> > ... >> >> >> yes. Either way, I would like to very much understand how server is >> preferring 3m cost plan to 2.6k cost plan or is otherwis

Re: [GENERAL] What is the purpose of PostGIS on PostgreSQL?

2017-01-23 Thread Merlin Moncure
On Mon, Jan 23, 2017 at 11:08 AM, Kased, Razy (Chemistry and Geosciences) wrote: > I recently came across this question: "What is the purpose of PostGIS on > PostgreSQL?" and wanted to know what this mailing list had to respond with. PostGIS is a SQL wrapper to the GEOS library which lets you do

Re: [GENERAL] Can we not give tyrannical pedants control of #postgresql?

2017-02-01 Thread Merlin Moncure
On Thu, Jan 19, 2017 at 5:23 PM, Julian Paul wrote: > I hope that particular stereotypes aren't proven here, but it appears > #postgresql encourages a particular tier and makes aware of it's rigid > hierarchy. I owe alot to #postgresql but not to these particular users, I've > perhaps been idle fo

  1   2   3   4   5   6   7   8   9   10   >