Re: [GENERAL] Drop/Re-Creating database extremely slow + doesn't lose data

2016-05-31 Thread Thalis Kalfigkopoulos
why, but yes, I am doing all operations connected from template1. BR, Thalis K. On Tue, May 31, 2016 at 4:02 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Tue, May 31, 2016 at 9:49 AM, Thalis Kalfigkopoulos > wrote: > >> Intention: to drop a database and

[GENERAL] Drop/Re-Creating database extremely slow + doesn't lose data

2016-05-31 Thread Thalis Kalfigkopoulos
Intention: to drop a database and recreate it. Expectation: the newly created db should be empty What happens: dropping is fast, creation is slow, and when I reconnect, all the data objects are still there. Commands (tried both through command line with dropdb/createdb and through psql) pgdba@tem

Re: [GENERAL] Backend process is still runs even postmaster got killed

2012-12-07 Thread Thalis Kalfigkopoulos
On Fri, Dec 7, 2012 at 10:21 AM, Hari Babu wrote: > Backend processes are still running even if the postmaster got killed and > all other server processes are exited by checking the > > Postmaster status. > > ** ** > > And the backend process is providing the service to the client. >

Re: [GENERAL] Folder filenode in tablespace location not indentifiable by oid2name

2012-11-09 Thread Thalis Kalfigkopoulos
On Fri, Nov 9, 2012 at 12:29 PM, Albe Laurenz wrote: > Thalis Kalfigkopoulos wrote: > > A tablespace is created successfully and so is a test table in it: > > # CREATE TABLESPACE ts_name LOCATION '/path/to/tablespace/location'; > > # SET default_tablesp

[GENERAL] Folder filenode in tablespace location not indentifiable by oid2name

2012-11-09 Thread Thalis Kalfigkopoulos
Hi all. A tablespace is created successfully and so is a test table in it: # CREATE TABLESPACE ts_name LOCATION '/path/to/tablespace/location'; # SET default_tablespace=ts_name; # CREATE TABLE ts_test_table; >From the command line: $ cd /path/to/tablespace/location $ ls PG_9.1_201105231 $ cd PG_9

Re: [GENERAL] Quick estimate of num of rows & table size

2012-11-05 Thread Thalis Kalfigkopoulos
On Mon, Nov 5, 2012 at 9:04 PM, Lonni J Friedman wrote: > On Mon, Nov 5, 2012 at 3:56 PM, Thalis Kalfigkopoulos > wrote: > > > > On Mon, Nov 5, 2012 at 7:14 PM, Lonni J Friedman > wrote: > >> > >> On Mon, Nov 5, 2012 at 2:02 PM, Thalis Kalfigkopoulos >

Re: [GENERAL] Quick estimate of num of rows & table size

2012-11-05 Thread Thalis Kalfigkopoulos
On Mon, Nov 5, 2012 at 7:14 PM, Lonni J Friedman wrote: > On Mon, Nov 5, 2012 at 2:02 PM, Thalis Kalfigkopoulos > wrote: > > Hi all, > > > > I read somewhere that the following query gives a quick estimate of the > # of > > rows in a table regardless of the tabl

[GENERAL] Quick estimate of num of rows & table size

2012-11-05 Thread Thalis Kalfigkopoulos
Hi all, I read somewhere that the following query gives a quick estimate of the # of rows in a table regardless of the table's size (which would matter in a simple SELECT count(*)?): SELECT (CASE WHEN reltuples > 0 THEN pg_relation_size('mytable')/(8192*relpages/reltuples) ELSE 0 END)::bigint AS

Re: [GENERAL] Server to run Postgresql

2012-11-03 Thread Thalis Kalfigkopoulos
On Sat, Nov 3, 2012 at 8:08 PM, Bob Pawley wrote: > Hi > > I have an unused computer which I am considering turning into a server to > run my Postgresql database. > > Is this even possible to do? > > If so, can someone suggest an open source server that is relatively easy > to set up? Windows b

[GENERAL] Pg isolation levels: 3 or 2?

2012-11-03 Thread Thalis Kalfigkopoulos
Hi all. >From the current docs (Ch.13 on Concurreny Control): "In PostgreSQL, you can request any of the four standard transaction isolation levels. But internally, there are only three distinct isolation levels, which correspond to the levels Read Committed, Repeatable Read, and Serializable. Wh

[GENERAL] overloading LIKE operator to handle integer + text

2012-10-30 Thread Thalis Kalfigkopoulos
Hi all, I'd like to be able to operate LIKE using as arguments an integer and a text value. In postgresql 9.0 the following raises an error: # SELECT 123 LIKE '123'; ERROR: operator does not exist: integer ~~ unknown LINE 1: select 123 like '123'; ^ HINT: No operator matches t

Re: [GENERAL] obtain the difference between successive rows

2012-10-20 Thread Thalis Kalfigkopoulos
> What about if there is more than one column you want the difference for (... > coincidentally I am writing a article on this topic right now! ...), say a > table which is used to record a metered quantity at not-quite regular > intervals: > > CREATE TABLE electricity > ( > current_reading_date

Re: [GENERAL] obtain the difference between successive rows

2012-10-20 Thread Thalis Kalfigkopoulos
On Sat, Oct 20, 2012 at 8:02 AM, Raymond O'Donnell wrote: > On 20/10/2012 11:54, ochaussavoine wrote: >> Hi, >> I have a table 'tmvt' with a field 'created' in the row, and would like to >> compute the difference between successive rows. The solution I found is: >> > > I think you can do it with a

[GENERAL] pgwatch: installs but doesn't display anything

2012-10-19 Thread Thalis Kalfigkopoulos
Hi all, trying to run pgwatch1.0 on Ubuntu 12.04 through a Bitnami LAPPstack. # select version(); PostgreSQL 9.1.1 on i686-pc-linux-gnu, compiled by gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5), 32-bit Pgwatch installation finishes OK but the webpages of pgwatch display nothing. Overview: ha

Re: [GENERAL] PostgreSQL training recommendations?

2012-10-16 Thread Thalis Kalfigkopoulos
On Tue, Oct 16, 2012 at 3:41 PM, Bruce Momjian wrote: > On Tue, Oct 16, 2012 at 02:34:37PM -0400, Bruce Momjian wrote: >> On Tue, Oct 16, 2012 at 02:53:14PM -0300, Thalis Kalfigkopoulos wrote: >> > I assume the EntrerpriseDB certification seminars are an obvious quick >

Re: [GENERAL] PostgreSQL training recommendations?

2012-10-16 Thread Thalis Kalfigkopoulos
I assume the EntrerpriseDB certification seminars are an obvious quick answer: http://www.enterprisedb.com/products-services-training/training/dba-training But TBH, I find the PostgreSQL manual to be an excelent guide if you don't mind reading. It is extremely well written (kudos to whoever is on

[GENERAL] tablespace_oid alias?

2012-10-12 Thread Thalis Kalfigkopoulos
Hi all, I want to get the databases that correspond to a certain tablespace through a call to pg_tablespace_databases(tablespace_oid) Which would be the OID alias type for tablespace_oid? I've tried: # select pg_tablespace_databases('pg_default'::XXX); with XXΧ as any of the OID aliases mention

[GENERAL] AS s(a) vs. AS a

2012-10-11 Thread Thalis Kalfigkopoulos
Hi all. I see in the docs the following: SELECT current_date + s.a AS dates FROM generate_series(0,14,7) AS s(a); Trying it as: SELECT current_date + a AS dates FROM generate_series(0,14,7) AS a; yields exactly the same result. Does the finer granularity/expressiveness offer some extra function

[GENERAL] Trajectory of a [Pg] DBA

2012-10-04 Thread Thalis Kalfigkopoulos
Hi all. I'd like to tap into the list's experience regarding the job of a DBA in general and Pg DBA in particular. I see that most of the DBA job posts ask for Sr or Ssr which is understandable given that databases are among a company’s most valuable assets, but it is also an obvious catch-22. So

Re: [GENERAL] CASE/WHEN behavior with NULLS

2012-09-01 Thread Thalis Kalfigkopoulos
On Sat, Sep 1, 2012 at 6:19 AM, David Johnston wrote: > On Aug 31, 2012, at 22:49, Tom Lane wrote: > >> David Johnston writes: >>> On Aug 31, 2012, at 21:52, Tom Lane wrote: David Johnston writes: > That said you might want to try > SUM(COALESCE(foo, 0)) >> Actually I'd go wi

[GENERAL] CASE/WHEN behavior with NULLS

2012-08-31 Thread Thalis Kalfigkopoulos
Hello all, I have a query that presents a sum() where in some records it's NULL because all members of the group are NULL. I decided I wanted to see a pretty 0 instead of NULL since it fits the logic of the app. This didn't work as expected (the NULL's persisted): ...CASE sum(foo) WHEN NULL THEN

Re: [GENERAL] NULL value comparison

2012-08-22 Thread Thalis Kalfigkopoulos
Hi Michael. NULL is not any specific value. Thus Pg correctly doesnot tell you that it is <>'Y'. It is NULL means that we dont know the value. Thus it may be 'Y' as much as it may not be 'Y'. The comparison is not applicable in the case of NULL and that's why there are the IS NULL and IS NOT NULL

Re: [GENERAL] Different results from view and from its defintion query [w/ windowing function]

2012-08-20 Thread Thalis Kalfigkopoulos
uot; works correctly. Alternatively your suggestion of adding an "ORDER BY insertedon" clause also seems to work. It makes the first_value(insertedon) behave as min(insertedon). thanks again, Thalis K. On Mon, Aug 20, 2012 at 12:16 PM, Tom Lane wrote: > Thalis Kalfigkopoulos writes: > &g

[GENERAL] Different results from view and from its defintion query [w/ windowing function]

2012-08-19 Thread Thalis Kalfigkopoulos
Sorry for the lack of a more appropriate title. The summary of my problem is: i run a query and I get some results; then I create a view using this query, and I run the same query on the view, and get different results. Details follow. On the original table the analytical data is as follows: # SEL