Re: [GENERAL] core system is getting unresponsive because over 300 cpu load

2017-10-10 Thread Victor Yegorov
c087d14 And also this query: SELECT name,version,source FROM pg_settings WHERE source NOT IN ('default','override'); -- Victor Yegorov

Re: [GENERAL] core system is getting unresponsive because over 300 cpu load

2017-10-10 Thread Victor Yegorov
d more details in this post: http://blog.postgresql- consulting.com/2017/03/deep-dive-into-postgres-stats_27.html (You might want to reset 'shared' stats here.) -- Victor Yegorov

Re: [GENERAL] Converting inherited partitions into declarative ones

2017-09-29 Thread Victor Yegorov
2017-09-29 20:32 GMT+03:00 Victor Yegorov : > > Is it possible to avoid Full Scan here? I have TBs worth of data in > partitions, > so it'll takes ages to switch to the declarative partitioning the way > things stand now. > OK, looking at the source code helped — I nee

[GENERAL] Converting inherited partitions into declarative ones

2017-09-29 Thread Victor Yegorov
akes ages to switch to the declarative partitioning the way things stand now. Thanks in advance. -- Victor Yegorov

Re: [GENERAL] londiste3: removing a node that does not exist

2017-06-22 Thread Victor Yegorov
ation WHERE queue_name='q-2rm'; And restarted worker after that. -- Victor Yegorov

Re: [GENERAL] Limit Heap Fetches / Rows Removed by Filter in Index Scans

2016-08-19 Thread Victor Blomqvist
On Sat, Aug 20, 2016 at 1:13 AM, Francisco Olarte wrote: > Hi Victor: > > > On Fri, Aug 19, 2016 at 7:02 PM, Victor Blomqvist wrote: > > What I want to avoid is my query visiting the whole 1m rows to get a > result, > > because in my real table that can take 100s

Re: [GENERAL] Limit Heap Fetches / Rows Removed by Filter in Index Scans

2016-08-19 Thread Victor Blomqvist
On Fri, Aug 19, 2016 at 6:01 PM, Francisco Olarte wrote: > Hi Victor: > > On Fri, Aug 19, 2016 at 7:06 AM, Victor Blomqvist wrote: > > Is it possible to break/limit a query so that it returns whatever results > > found after having checked X amount of rows in a index scan

Re: [GENERAL] Limit Heap Fetches / Rows Removed by Filter in Index Scans

2016-08-18 Thread Victor Blomqvist
On Fri, Aug 19, 2016 at 1:31 PM, Sameer Kumar wrote: > > > On Fri, 19 Aug 2016, 1:07 p.m. Victor Blomqvist, wrote: > >> Hi, >> >> Is it possible to break/limit a query so that it returns whatever results >> found after having checked X amount of row

[GENERAL] Limit Heap Fetches / Rows Removed by Filter in Index Scans

2016-08-18 Thread Victor Blomqvist
ral 100k or more, and in those cases I would like to have a limit to my query. Thanks! /Victor

Re: [GENERAL] Retrieving value of column X days later

2016-08-07 Thread Victor Yegorov
e quoting identifiers. Try this query with window functions: SELECT *,lead(foo,4) OVER (ORDER BY when_d), last_value(foo) OVER (ORDER BY when_d RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM test; This will give you the ability to lookup needed values. You'll have to use subquery though, as window functions are evaluated after the `WHERE` clause. -- Victor Y. Yegorov

[GENERAL] Re: [GENERAL] ФС против Постгреса для файлов

2016-08-07 Thread Victor Yegorov
йликов для ФС и Постгреса. > Отдачу сделать на базе nginx и , мне хотелось, Lua модуля. Что еще > учесть для тестов? > This is an English speaking forum. Please, use `pgsql-ru-general` instead for posts on Russian. -- Victor Y. Yegorov

Re: [GENERAL] Corrupted Dabatabase

2016-06-27 Thread Sterpu Victor
You probably have a HDD problem. Try a "cat /proc/mounts" and see if partition is mounted read only. -- Original Message -- From: "Pau Marc Muñoz Torres" To: "pgsql general" Sent: 27/6/2016 4:28:35 PM Subject: [GENERAL] Corrupted Dabatabase Hello Everydody, My database is corrupted,

Re: [GENERAL] Ascii Elephant for text based protocols - Final

2016-05-17 Thread Victor Yegorov
12176b12173b17111752171927491b1744171b17411217181417211718141734172b191721191724173b1714171912175b17221b1912174b1412178b121715122a172a1b2317d91a172a17f71b1a1912177') ), str AS ( SELECT string_agg(repeat(translate(substr(s, p, 1), '123456789ab', '(/>)<+ o_|\'), ('x'||lpad(substr(s, p+1, 1), 8, '0'))::bit(32)::int), '') line FROM src, generate_series(1, 182, 2) p ) SELECT substr(line, p, 21) slon FROM str, generate_series(1, 189, 21) p; -- Victor Y. Yegorov

Re: [GENERAL] Slow query when the select list is big

2016-05-09 Thread Sterpu Victor
some of these parameters, I will try all tomorow. -- Original Message -- From: "Karl Czajkowski" To: "Sterpu Victor" Cc: "PostgreSQL General" Sent: 9/5/2016 8:47:12 PM Subject: Re: Slow query when the select list is big On May 09, Sterpu Victor modulat

Re: [GENERAL] Slow query when the select list is big

2016-05-09 Thread Sterpu Victor
I tested it now, EXPLAIN ANALYZE is not showing LEFT JOIN at all if I don't select from the joined tables. Now is clear why the query is so mutch more efficient when I select less data. Thank you -- Original Message -- From: "David Rowley" To: "Sterpu Vi

Re: [GENERAL] Slow query when the select list is big

2016-05-09 Thread Sterpu Victor
. -- Original Message -- From: "Sterpu Victor" To: "Sterpu Victor" ; "David Rowley" Cc: "Rob Imig" ; "PostgreSQL General" ; "David G. Johnston" Sent: 9/5/2016 11:01:56 AM Subject: Re[2]: [GENERAL] Slow query when the select li

Re: [GENERAL] Slow query when the select list is big

2016-05-09 Thread Victor Yegorov
2016-05-09 11:01 GMT+03:00 Sterpu Victor : > I went to 2.4 seconds by joining first the tables that produce many rows. As you're changing your query quite often, it'd be handy, if you could post both: - new query version - it's `EXECUTE (analyze, buffers)` output If you pro

Re: [GENERAL] Slow query when the select list is big

2016-05-09 Thread Sterpu Victor
DATE(J1031101.validfrom)<= DATE('2016-05-01') )) ORDER BY J1031101.validfrom DESC LIMIT 20 OFFSET 0 -- Original Message -- From: "Sterpu Victor" To: "David Rowley" Cc: "Rob Imig" ; "PostgreSQL General" ; "David G. Jo

Re: [GENERAL] Slow query when the select list is big

2016-05-09 Thread Sterpu Victor
(J1033359.validto IS NULL AND DATE(J1031101.validfrom)<= DATE('2016-05-01') )) ORDER BY J1031101.validfrom DESC LIMIT 20 OFFSET 0 -- Original Message -- From: "David Rowley" To: "Sterpu Victor" Cc: "Rob Imig" ; "PostgreSQL General"

[GENERAL] Slow query when the select list is big

2016-05-08 Thread Sterpu Victor
I have a big query that takes about 7 seconds to run(time sending the data to the client is not counted). Postgres uses 100% of 1 CPU when solving this query. I tried to run the query on a HDD and on a SSD with no difference. HDD show about 10% usage while the query runs. The query has a big "

Re: [GENERAL] Get sum of sums

2016-05-03 Thread Victor Yegorov
X Bytes" DESC LIMIT 10; I am not sure bout the LIMIT though, I hope window function will be calculated after the LIMIT is applied. -- Victor Y. Yegorov

Re: [GENERAL] Slow join over three tables

2016-04-26 Thread Victor Yegorov
Can you post output of `EXPLAIN (analyze, buffers)`, please? It'd be good to check how many buffers are hit/read during Index Scans. I have had a somewhat similar case, when due to misconfigured autovacuum (not aggressive enough for the increased volume) I got bloat accumulated in the indexes. Perhaps, REINDEX can help here. -- Victor Y. Yegorov

[GENERAL] Types of blocks in the `pg_stat_statements`

2016-04-25 Thread Victor Yegorov
`hit` also speaks for this). But what `local` blocks mean? -- Victor Y. Yegorov

Re: [GENERAL] Unique values on multiple tables

2016-03-28 Thread Sterpu Victor
-- Original Message -- From: "Emre Hasegeli" To: "Sterpu Victor" Cc: "PostgreSQL General" Sent: 28/3/2016 12:06:23 PM Subject: Re: [GENERAL] Unique values on multiple tables I have 2 tables and I must make asure unique values like this. table1

Re: [GENERAL] Unique values on multiple tables

2016-03-27 Thread Sterpu Victor
I think I fixed the problem by executing the function AFTER insert or update but I'm not sure. Until now the execution was before insert or update. -- Original Message -- From: "Sterpu Victor" To: "PostgreSQL General" Sent: 28/3/2016 9:32:17 AM Subject: [

[GENERAL] Unique values on multiple tables

2016-03-27 Thread Sterpu Victor
Hello I have 2 tables and I must make asure unique values like this. table1 id nr - integer table2 id id_table1 - FK in Table 1 valid_from - timestamp There must be unique values for: - nr - from table1 and - YEAR(MIN(valid_from)) from table 2 I already made this with a function but in rare c

Re: [GENERAL] Including SQL files

2016-03-21 Thread Victor Yegorov
you share your approaches here? > If you're processing your files with Postgres' `psql` tool, you can use `\i` directive to include other files. -- Victor Y. Yegorov

Re: [GENERAL] Subtract one array from another, both with non-unique elements

2016-03-08 Thread Victor Yegorov
27;,'B','B','C'], ARRAY['A','B']); arrexcept --- {A,B,C} (1 row) But it doesn't preserves the order of the elements, not sure if this is important. -- Victor Y. Yegorov

Re: [GENERAL] index problems (again)

2016-03-07 Thread Victor Yegorov
finds the row that fits. Right now (9.5 and earlier versions) I do not know of any options that would not require fixing your queries. P.S. Maybe `Upper pathification` patch, that is being considered for 9.6, can deal with such cases. -- Victor Y. Yegorov

Re: [GENERAL] index problems (again)

2016-03-07 Thread Victor Yegorov
N 20160219 AND 20160221; ? -- Victor Y. Yegorov

Re: [GENERAL] CONCAT returns null

2016-02-28 Thread Sterpu Victor
The problem was from PG Admin that is not displaing cells with a high amount of data. In the application the query is working well. -- Original Message -- From: "Sterpu Victor" To: "PostgreSQL General" Sent: 28/2/2016 12:02:47 PM Subject: [GENERAL] CONCAT returns

[GENERAL] CONCAT returns null

2016-02-28 Thread Sterpu Victor
Hello I have this concat: CONCAT(f.nrfo, '/', TO_CHAR(fd1.validfrom, '-MM-DD'), f2.nrfo, TO_CHAR(fd7.validfrom, '-MM-DD'), DATE(fd5.validto)-DATE(fd1.validfrom)) that works fine but when I change to this(I added a ' with '): ARRAY_AGG(CONCAT(f.nrfo, '/', TO_CHAR(fd1.validfrom, '-MM

Re: [GENERAL] bpchar, text and indexes

2016-02-22 Thread Victor Yegorov
has to be casted > to text and then the index (which contains blank padded values) can not be > used any more. > Well, for `varchar` type Postgres is able to do `varchar` -> `bpchar` cast for my constant. I do not understand why for `text` it cannot and casts column instead. -- Victor Y. Yegorov

[GENERAL] bpchar, text and indexes

2016-02-22 Thread Victor Yegorov
ercible. Why Postgres is casting `sn_c` to `text` here, disabling index usage? 2. as I can see in `pg_cast`, setup for `varchar` is pretty much the same: `varchar` => `bpchar` is also binary coercible. So why for `varchar` behaviour is different? Thanks in advance. -- Victor Y. Yegorov

Re: [GENERAL] Query plan not updated after dropped index

2016-02-18 Thread Victor Blomqvist
On Thu, Feb 18, 2016 at 11:05 PM, Tom Lane wrote: > Victor Blomqvist writes: > > We just had a major issue on our databases, after a index was replaced a > > user defined function didnt change its query plan to use the new index. > > I'm suspicious that this is s

Re: [GENERAL] Query plan not updated after dropped index

2016-02-18 Thread Victor Blomqvist
The end goal is to get rid of index bloat. If there is a better way to handle this Im all ears! /Victor On Thu, Feb 18, 2016 at 5:21 PM, Oleg Bartunov wrote: > > > On Thu, Feb 18, 2016 at 11:17 AM, Victor Blomqvist wrote: > >> Hello! >> >> We just had a major i

[GENERAL] Query plan not updated after dropped index

2016-02-18 Thread Victor Blomqvist
LIMIT 100 OFFSET 0; And this is my modification that made it work again: RETURN QUERY SELECT * FROM table WHERE bigint_column = X AND 1=1 LIMIT 100 OFFSET 0; Obviously we are now worried why this happened and how we can avoid it in the future? We run Postgres 9.3 on CentOS 6. Thanks! Victor

Re: [GENERAL] Windows performance

2016-02-12 Thread Sterpu Victor
There are some differences that I haven't mentioned. Postgres on Linux is PostgreSQL 9.1.4 64 bit Postgres on Windows is PostgreSQL 9.5.0, compiled by Visual C++ build 1800, 64-bit The query is very big but I pasted it at the end of the mail with the EXPLAIN ANALYZE. I runned the queries many

[GENERAL] Windows performance

2016-02-12 Thread Sterpu Victor
Hello Why is Postgres so slow on Windows compared to linux? Can I do something to match the performance? I have 2 servers: - one is Windows 8, CPU XEON, 8 CORES, 32G of RAM - my test query runs in 17 seconds - the other is Linux CPU XEON, 4 cores, 4 Gh of RAM - my test query runs in 2 seconds

Re: [GENERAL] A motion

2016-01-24 Thread Victor Yegorov
e -general list. Let things settle down a bit for a while — I'm quite sure list will come back to it's common shape. Please, do not go :) -- Victor Y. Yegorov

Re: [GENERAL] Code of Conduct: Is it time?

2016-01-06 Thread Victor Yegorov
. Reminds me of what we do for the GSoC, where developers volunteer for mentoring students. Something similar would be handy in general, perhaps with a web interface similar to the CommitFest's one. -- Victor Y. Yegorov

Re: [GENERAL] Unique index problem

2015-12-21 Thread Sterpu Victor
Seems to be working also with a single index, like this: CREATE UNIQUE INDEX lab_tests_groups_siui_uni_c ON lab_tests_groups_siui(id_lab_tests_siui, id_lab_tests_groups, valid_from, coalesce(id_lab_sample_types, 0)); -- Original Message -- From: "Pavel Stehule" To: &quo

Re: [GENERAL] Unique index problem

2015-12-20 Thread Sterpu Victor
Thank you. I used the syntax with 2 indexes, it works for me. But why does NULL != NULL? -- Original Message -- From: "Marc Mamin" To: "Sterpu Victor" Cc: "PostgreSQL General" ; "Andreas Kretschmer" ; "Scott Marlowe" Sent: 12

[GENERAL] Unique index problem

2015-12-20 Thread Sterpu Victor
Hello I created a unique index that doesn't seem to work when one column is NULL. Index is created like this: CREATE UNIQUE INDEX lab_tests_groups_siui_uni ON lab_tests_groups_siui(id_lab_tests_siui, id_lab_tests_groups, valid_from, id_lab_sample_types); Now I can run this insert twice and I w

Re: [GENERAL] Index contains unexpected zero page at block

2015-12-16 Thread Victor Blomqvist
relevant for this I think) /Victor On Thu, Dec 17, 2015 at 12:22 PM, Tom Lane wrote: > Victor Blomqvist writes: > >> From time to time I get this and similar errors in my Postgres log file: > > < 2015-12-17 07:45:05.976 CST >ERROR: index > > "user_pictures_pic

[GENERAL] Index contains unexpected zero page at block

2015-12-16 Thread Victor Blomqvist
Is this anything I should be worried about, and if so, what can I do to fix it? Will it be fixed with a newer version of Postgres? Thanks! Victor

[GENERAL] "Immediate shutdown if postmaster.pid is removed" not mentioned in Release Notes

2015-12-16 Thread Victor Yegorov
I noticed, that 9.5 release notes (beta2) do not mention commit 7e2a18a9161fee7e67642863f72b51d77d3e996. I think this one should be added. -- Victor Y. Yegorov

Re: [GENERAL] DISTINCT in STRING_AGG

2015-11-30 Thread Sterpu Victor
t are the coordinates for each node and the result must be ordered by this to obtain the correct result. -- Original Message -- From: "Geoff Winkless" To: "Sterpu Victor" Cc: "PostgreSQL General" Sent: 11/29/2015 10:51:32 PM Subject: Re: Re[2]: [GENE

Re: [GENERAL] DISTINCT in STRING_AGG

2015-11-29 Thread Sterpu Victor
1399031" 1399031;"1399032,1399033" Is there a better way? I usualy try to avoid subqueries. -- Original Message -- From: "Geoff Winkless" To: "Sterpu Victor" Cc: "PostgreSQL General" Sent: 11/29/2015 6:42:18 PM Subject: Re: [GENERAL] DISTINCT

[GENERAL] DISTINCT in STRING_AGG

2015-11-28 Thread Sterpu Victor
Hello Can I make a distinct STRING_AGG? This is my query : SELECT atjs.id, STRING_AGG(CAST(aqjs1.id AS VARCHAR), ',' ORDER BY aqjs1.to_left) AS children FROM administration.ad_query_join_select atjs JOIN administration.ad_query aq ON (aq.id=atjs.id_ad_query) LEFT JOIN administration.ad_query_jo

Re: [GENERAL] ARRAY_AGG and ORDER

2015-11-26 Thread Sterpu Victor
Yes, thank you. :) -- Original Message -- From: "Sterpu Victor" To: "Geoff Winkless" Sent: 11/26/2015 2:51:48 PM Subject: Re[2]: [GENERAL] ARRAY_AGG and ORDER Yes, thank you. :) -- Original Message -- From: "Geoff Winkless" To: "Ster

[GENERAL] ARRAY_AGG and ORDER

2015-11-26 Thread Sterpu Victor
Hello I need to order an array using another column in table ad_query_join_select. I need something like this but this is not a valid SQL: SELECT array_to_string(array_agg(aqjs.id ORDER BY aqjs.to_left), ',') AS str, aq.name FROM ad_query aq JOIN ad_query_join_select aqjs ON (aqjs.id_ad_query

Re: [GENERAL] Drop or alter column under load give ERROR #42804 structure of query does not match function result type:

2015-11-04 Thread Victor Blomqvist
On Wed, Nov 4, 2015 at 1:31 AM, Tom Lane wrote: > Victor Blomqvist writes: > > In case any of you are interested of recreating this problem, I today had > > the time to create a short example that reproduce the error every time I > > try. > > Hmm. If you just do th

Re: [GENERAL] Drop or alter column under load give ERROR #42804 structure of query does not match function result type:

2015-11-02 Thread Victor Blomqvist
On Mon, Oct 12, 2015 at 10:15 PM, Adrian Klaver wrote: > On 10/12/2015 06:53 AM, Tom Lane wrote: > >> Andres Freund writes: >> >>> On 2015-10-09 14:32:44 +0800, Victor Blomqvist wrote: >>> >>>> CREATE FUNCTION select_users(id_ integer) RETURNS SET

Re: [GENERAL] Drop or alter column under load give ERROR #42804 structure of query does not match function result type:

2015-10-12 Thread Victor Blomqvist
changes when there are people in the office. /Victor On Mon, Oct 12, 2015 at 10:15 PM, Adrian Klaver wrote: > On 10/12/2015 06:53 AM, Tom Lane wrote: > >> Andres Freund writes: >> >>> On 2015-10-09 14:32:44 +0800, Victor Blomqvist wrote: >>> >>>> C

Re: [GENERAL] Drop or alter column under load give ERROR #42804 structure of query does not match function result type:

2015-10-11 Thread Victor Blomqvist
On Sat, Oct 10, 2015 at 10:00 PM, Adrian Klaver wrote: > On 10/09/2015 08:30 PM, Victor Blomqvist wrote: > >> Note that these errors most of the time only happens very briefly at the >> same time as the ALTER is run. When I did some experiments today the >> server in t

Re: [GENERAL] Drop or alter column under load give ERROR #42804 structure of query does not match function result type:

2015-10-09 Thread Victor Blomqvist
; Thanks for your help so far! /Victor On Fri, Oct 9, 2015 at 10:49 PM, Adrian Klaver wrote: > On 10/09/2015 07:31 AM, Albe Laurenz wrote: > >> Adrian Klaver wrote: >> >>> For the reason why this is happening see: >>>>> >>>>> >

[GENERAL] Drop or alter column under load give ERROR #42804 structure of query does not match function result type:

2015-10-08 Thread Victor Blomqvist
-number-of-columns-errors Thanks! Victor

Re: [GENERAL] Why does this SQL work?

2015-05-11 Thread Victor Yegorov
`msgid` in the subquery. That's why it is always a good idea to prefix all your columns with tables aliases. -- Victor Y. Yegorov

Re: [GENERAL] Subselect with no records results in final empty set

2015-01-30 Thread Sterpu Victor
ql-general@postgresql.org Sent: 1/29/2015 10:52:25 PM Subject: Re: [GENERAL] Subselect with no records results in final empty set On 1/29/2015 12:36 PM, Sterpu Victor wrote: ON(null) never matched. NULL is neither true nor false. ON somefieldinthejoin IS NULL would be a valid syntax. except, that&#x

Re: [GENERAL] Subselect with no records results in final empty set

2015-01-29 Thread Sterpu Victor
I changed the final query to SELECT * FROM (SELECT 1 AS t1, 2 AS t2) AS t1 LEFT JOIN (SELECT * FROM atc WHERE id = '1231222') AS t2 ON (1=1) ON(null) never matched. -- Original Message -- From: "Sterpu Victor" To: "David G Johnston" ; pgsql-general@postgr

Re: [GENERAL] Subselect with no records results in final empty set

2015-01-29 Thread Sterpu Victor
/29/2015 10:03:38 PM Subject: Re: [GENERAL] Subselect with no records results in final empty set Sterpu Victor wrote Hello I have this select where the last subselect will return a empty set and because of this the whole select will be empty. How can I change this syntax so I will have a ro

Re: [GENERAL] Can I unite 2 selects?

2015-01-29 Thread Sterpu Victor
Thank you. This is the syntax I was looking for. -- Original Message -- From: "Adrian Klaver" To: "Sterpu Victor" ; "PostgreSQL General" Sent: 1/29/2015 9:09:31 PM Subject: Re: [GENERAL] Can I unite 2 selects? On 01/29/2015 10:58 AM, Sterpu Victor wr

[GENERAL] Subselect with no records results in final empty set

2015-01-29 Thread Sterpu Victor
Hello I have this select where the last subselect will return a empty set and because of this the whole select will be empty. How can I change this syntax so I will have a row result even if the last select is empty? SELECT * FROM (SELECT 1 AS t1, 2 AS t2) as t, (SELECT 3 AS t3) as s, (SELECT *

[GENERAL] Can I unite 2 selects?

2015-01-29 Thread Sterpu Victor
Hello Can I write a query where I receive a single result set from many queries? Something like this: SELECT (SELECT 1 AS t1, 2 AS t2), (SELECT 3 AS t3) I tried exactly this but the error is: "ERROR: subquery must return only one column" But I don't see why it must have only one column. Thank y

[GENERAL] Postgresql 9.4 session vars

2015-01-24 Thread Sterpu Victor
Hello In previous versions I was able to define session vars in postgresql.conf with the option "custom_variable_classes" but this option is no longer available. Is there a replacement for this in postgres 9.4? Thank you --- This email has been checked for viruses by Avast antivirus software.

Re: [GENERAL] ALTER TYPE ... ADD VALUE issue

2014-10-20 Thread Victor Yegorov
2014-10-20 21:43 GMT+03:00 Adrian Klaver : > With \set AUTOCOMMIT off the COMMIT ended one transaction block and > started another. I don't think `COMMIT` starts a new transaction block here, as I can run `VACUUM` after it, and vacuum also cannot be run inside transaction block. -

[GENERAL] ALTER TYPE ... ADD VALUE issue

2014-10-20 Thread Victor Yegorov
AUTOCOMMIT off CREATE TYPE enum_type AS ENUM ('bad', 'good'); CREATE TYPE COMMIT; COMMIT ALTER TYPE enum_type ADD VALUE 'so-so' AFTER 'bad'; ERROR: ALTER TYPE ... ADD cannot run inside a transaction block What is wrong here? -- Victor Y. Yegorov

[GENERAL] Does writing new records while massive update will generate lock ?

2014-08-21 Thread Victor d'Agostino
WHERE INDEXEDTABLE.email_id=MYBIGTABLE.email_id) WHERE date is null; This transaction is still running and will end in several days. It only uses 1 core. My question is : Can I add new records in the table or will it generate locks ? I am using postgresql *8.4* Thanks for your help ! Regards, V

Re: [GENERAL] TZ_OFFSET

2014-07-29 Thread Victor Yegorov
2014-07-28 13:19 GMT+03:00 Ramesh T : > select TZ_OFFSET ('US/Eastern'); > > its'returning like function tz_offset('us/Eastern') does not exist; > SELECT * FROM pg_catalog.pg_timezone_names WHERE name='US/Eastern'; -- Victor Y. Yegorov

Re: [GENERAL] Query with error - DOW FROM timestamp

2014-05-25 Thread Victor Sterpu
Yes, thank you. -- Original Message -- From: "Albe Laurenz" To: "Victor Sterpu" ; "PostgreSQL General" Sent: 5/23/2014 12:51:30 PM Subject: RE: [GENERAL] Query with error - DOW FROM timestamp Victor Sterpu wrote: When I run the query from down

[GENERAL] Query with error - DOW FROM timestamp

2014-05-23 Thread Victor Sterpu
Hello When I run the query from down I receive an error. How can I write this query to receive the day ot the week. SELECT EXTRACT(DOW FROM timestamp TO_TIMESTAMP('14-10-2011', 'DD-MM-')); Thank you

Re: [GENERAL] Constraint exclusion for timestamp expression

2014-05-20 Thread Victor Yegorov
2014-05-20 14:26 GMT+03:00 Tom Lane : > Victor Yegorov writes: > > How can I enforce pruning to kick in for the initial expressions? > > You already found out: use constants. The planner can't remove > partitions on the basis of clauses involving volatile, or even >

[GENERAL] Constraint exclusion for timestamp expression

2014-05-20 Thread Victor Yegorov
onstraint_exclusion` is default: partition This happens on 9.1.13, but I get the same plans also on 9.3.4. How can I enforce pruning to kick in for the initial expressions? -- Victor Y. Yegorov

[GENERAL] Correct syntax

2014-04-11 Thread Victor Sterpu
How would I write sutch a query? SELECT to_timestamp ('10-10-2013 15:00', 'DD-MM- HH24:MI') + interval REPLACE('1.30', '.', ':')||' hours' This gives error at REPLACE. Thank you.

Re: [GENERAL] Lock problem

2014-04-02 Thread Victor Sterpu
I'm sure is not right, but is a there a server side solution for such sitations? A configuration - timeout for idle transactions. -- Original Message -- From: "Victor Sterpu" To: "Victor Sterpu" ; "Merlin Moncure" Cc: "PostgreSQL General&q

Re: [GENERAL] Lock problem

2014-04-02 Thread Victor Sterpu
arted transaction will never be commited 3. from the server point of view there is a unfinished transaction that will block future statements Is this normal behaviour? -- Original Message -- From: "Victor Sterpu" To: "Merlin Moncure" Cc: "PostgreSQL General"

Re: [GENERAL] Lock problem

2014-04-02 Thread Victor Sterpu
I followed all your advice and it is obiuos that this log will show exactly what I need to debug the situation. Great tip, thank you. -- Original Message -- From: "Merlin Moncure" To: "Victor Sterpu" Cc: "PostgreSQL General" Sent: 4/2/2014 7:08:08

Re: [GENERAL] Lock problem

2014-04-02 Thread Victor Sterpu
-- Original Message -- From: "Igor Neyman" To: "Victor Sterpu" ; "pgsql-general@postgresql.org" Sent: 4/2/2014 6:29:17 PM Subject: RE: [GENERAL] Lock problem From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On

Re: [GENERAL] Lock problem

2014-04-02 Thread Victor Sterpu
-- Original Message -- From: "Merlin Moncure" To: "Victor Sterpu" Cc: "PostgreSQL General" Sent: 4/2/2014 6:49:28 PM Subject: Re: [GENERAL] Lock problem On Wed, Apr 2, 2014 at 10:19 AM, Victor Sterpu wrote: Hello I have a problem that it

Re: [GENERAL] Lock problem

2014-04-02 Thread Victor Sterpu
-- Original Message -- From: "Tom Lane" To: "Victor Sterpu" Cc: pgsql-general@postgresql.org Sent: 4/2/2014 6:31:13 PM Subject: Re: [GENERAL] Lock problem "Victor Sterpu" writes: I have a problem that it seems to be very hard to debug. Problem is

[GENERAL] Lock problem

2014-04-02 Thread Victor Sterpu
Hello I have a problem that it seems to be very hard to debug. Problem is from some postgresql locks. I use PostgreSQL 9.1.8. I runned this query to fid the locks: SELECT bl.pid AS blocked_pid, a.usename AS blocked_user, kl.pid AS blocking_pid, ka.usename AS blocking_user, a.current_query AS b

Re: [GENERAL] Join Bad Performance on different data types

2014-03-05 Thread Victor Yegorov
ude as latlon FROM first JOIN graph2 gcr ON gcr.id=ANY(first.detail_id) JOIN graph3 gtd ON gtd.id=gcr.t_ids JOIN graph1 glt ON glt.id=ANY(gtd.id_list) 4. Try disabling materialization, like `set enable_material=off`. -- Victor Y. Yegorov

Re: [GENERAL] Join Bad Performance on different data types

2014-03-04 Thread Victor Yegorov
rite the query so that i need not to set > seqscan-off, because i dont want to embed one more line in application > code and also dont want to change global setting in postgresql.conf to > disable seqscan. > Could you, kindly, also post `EXPLAIN` output of your original and modified queries also, leaving out all `enable_...` setting at their defaults. Just explain, without `analyze`. -- Victor Y. Yegorov

[GENERAL] Question on Sort node's actual rows

2014-01-23 Thread Victor Yegorov
"Rows Removed by Filter: 382 "Buffers: shared hit=13 This is: PostgreSQL 9.3.1 on x86_64-apple-darwin12.5.0, compiled by i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00), 64-bit -- Victor Y. Yegorov

[GENERAL] Unexpected update behaviour

2013-12-13 Thread Victor Yegorov
PDATE works (but takes hours on my full data); - if I convert this UPDATE into a SELECT, I get the row to be updated. Could you kindly explain me why the query as it is updates no records? -- Victor Y. Yegorov create.sql Description: Binary data update.sql Description: Binary data -- Sen

Re: [GENERAL] Breaking up a PostgreSQL COPY command into chunks?

2013-11-08 Thread Victor Hooi
er approach? Reasons? (Not challenging it, I just want to understand everything). Cheers, Victor On Fri, Nov 8, 2013 at 6:36 PM, Francisco Olarte wrote: > On Fri, Nov 8, 2013 at 5:09 AM, Victor Hooi wrote: > > They think that it might be limited by the network, and how fast the >

Re: [GENERAL] Breaking up a PostgreSQL COPY command into chunks?

2013-11-07 Thread Victor Hooi
y are connected over the internet). Cheers, Victor On Fri, Nov 8, 2013 at 1:44 PM, Victor Hooi wrote: > Hi, > > Hmm, ok, I'll pass that onto our DBA/operations guys, and see if that > helps. > > Do these settings still work if you only have a single Postgres instance? >

Re: [GENERAL] Breaking up a PostgreSQL COPY command into chunks?

2013-11-07 Thread Victor Hooi
ppening, or how this might fix it? And you'd recommend tweaking these values over trying to chunk up the COPY/SELECT, is that right? I've just realised the LIMIT/ORDER thing may not work well to paginate, since there may be new records, or deleted records between each time I call it? Cheer

[GENERAL] Breaking up a PostgreSQL COPY command into chunks?

2013-11-07 Thread Victor Hooi
the end of the results set though (apart from just counting the results?). Or are there other approaches you guys could recommend? Cheers, Victor

Re: [GENERAL] Idle transactions in PostgreSQL 9.2.4

2013-10-17 Thread Victor Yegorov
ast query_ executed by the session. Check here: http://www.postgresql.org/docs/9.2/static/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW -- Victor Y. Yegorov

Re: [GENERAL] "Pretend" update

2013-10-01 Thread Victor Yegorov
within the same transaction. > Dohhh... > It is possible to use RETURNING clause of the UPDATE statement and avoid SELECT. And yes, it is necessary to do this within a transaction and roll it back after. -- Victor Y. Yegorov

Re: [GENERAL] Performance of ORDER BY RANDOM to select random rows?

2013-08-11 Thread Victor Hooi
ct things. Are there any other database backends that do things differently? (I know that SQL Server suggests using NEWID to do things - http://msdn.microsoft.com/en-us/library/cc441928.aspx). Cheers, Victor On Fri, Aug 9, 2013 at 10:43 AM, Sergey Konoplev wrote: > On Wed, Aug 7, 2013 at

[GENERAL] Performance of ORDER BY RANDOM to select random rows?

2013-08-07 Thread Victor Hooi
Y RANDOM change sometime recently? Cheers, Victor

Re: [GENERAL] postgresql query

2013-06-19 Thread Victor Yegorov
gt; --- > 2000 -1000 > How do we decide wether 2000 or -1000 refers to the “In quantity”? Can you show a complete table's structure, please? -- Victor Y. Yegorov

Re: [GENERAL] Sum raw with the same continuous flags

2013-06-01 Thread Victor Yegorov
your table though, as results will change otherwise based on your DB activity. Inspired by this answer: http://stackoverflow.com/a/10624628/1154462 -- Victor Y. Yegorov

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread Victor Yegorov
ry slowdown. -- Victor Y. Yegorov

Re: [GENERAL] Cat the query be tuned further ?

2013-05-31 Thread Victor Yegorov
d of BitmapScan. 2) Create new index on tableA (or change tableA_inr_dt perhaps): CREATE INDEX i_ta_inr_date_dtrunc ON tableA (inr_id, analytics_date, date_trunc('month',analytics_date), total_cost); Same here. I assume IndexOnly scan be used and also first 3 columns of t

Re: [GENERAL] Seq Scan cost shown to be (cost=10000000000.00..10000000001.10)

2013-05-27 Thread Victor Yegorov
QL just sets really high costs for the operations affected (like the one you see). As SeqScan is the only possible way to execute your query, it is still choosen. Somewhat related thread: http://www.postgresql.org/message-id/4d5b06ac.2020...@lelarge.info -- Victor Y. Yegorov

Re: [GENERAL] Referencing parts captured by round brackets in a regex in 8.4.13

2013-03-22 Thread Victor Yegorov
\1\\1'; > ^ > HINT: Use the escape string syntax for backslashes, e.g., E'\\'. > ?column? > -- > t > (1 row) > Please, check this part of the docs (note the Caution): http://www.postgresql.org/docs/8.4/static/sql-syntax

  1   2   >