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

[GENERAL] FATAL: invalid frontend message type 47 server closed the connection unexpectedly

2007-01-17 Thread Sterpu Victor
I receive this message when I do a specific operation. How can I debug something like this? I use a Centos 4.0 distribution, postgresql version 8.1.3(I also used diffrent distibutions and other versions of postgresql). I connect to postgresql using perl DBD::Pg, using a tcp socket. The error a

[GENERAL] FATAL: invalid frontend message type 47

2006-01-24 Thread Sterpu Victor
After a commit I receive this message: "FATAL: invalid frontend message type 47", and rollback. ---(end of broadcast)--- TIP 6: explain analyze is your friend

[GENERAL] date/time function

2005-12-01 Thread Sterpu Victor
I need a function that will transform from the format '2002-09-08 05:29:41' to seconds since 1970. Thank you. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

[GENERAL] sequence problem - many rows

2005-11-29 Thread Sterpu Victor
I have the following table Column | Type |Modifiers +---+- id | integer | not null default nextval('cachedgroupmembers_id_seq'::regclass) groupid

Re: [GENERAL] sequence problem - many rows

2005-11-29 Thread Sterpu Victor
I shoul start the sequence with the last number in the higher number in the table +1. It works. Sterpu Victor wrote: I have the following table Column | Type |Modifiers

[GENERAL] createdb problem

2005-09-24 Thread Sterpu Victor
I use postgresql 7.4.8. I need te delete and recreate a database very ofent, because I do some tests in it. After a few months the command createdb becamed very slow. How can I make it go fast again? Thank you. ---(end of broadcast)--- TIP 3: Ha

[GENERAL] concatenate text

2005-09-04 Thread Sterpu Victor
Can I do something like this? SELECT sum(name) FROM table; Where name is a text field. I know 'sum' doesn't work, but is there another solution? '||' is not good because it will take just 2 arguments. Thank you. ---(end of broadcast)--- TIP 4: Hav