[GENERAL] Query slower if i add an additional order parameter

2011-02-14 Thread Janning Vygen
Hi, postgresql 8.4 (tuned, analyzed, and so on) we had trouble with one query executing too slow. After checking out some alternatives we encountered that dropping a rather useless second parameter on order by the execution time dropped dramatically. This is our original query with 2 order

Re: [GENERAL] Multithreaded query onto 4 postgresql instances

2011-02-14 Thread Alessandro Candini
No, this database is on a single machine, but a very powerful one. Processors with 16 cores each and ssd disks. I already use partitioning and tablespaces for every instance of my db and I gain a lot with my splitted configuration. My db is pretty huge: 600 milions of records and partitioning

Re: [GENERAL] Multithreaded query onto 4 postgresql instances

2011-02-14 Thread Alessandro Candini
For shure my life is more complex with this configuration :-D But the performance tests that I performed (described in the prevoius thread) tell me that this is a good way... Otherwise you probably didn't gain anything by splitting your database up like that - you've just reduced the available

Re: [GENERAL] Upgrading to 9.0 on Mac OS X

2011-02-14 Thread Basil Bourque
To be clear about the 2 passwords involved with Postgres on your Mac: • The installer asks for your usual Mac admin account password, to get permission for 2 operations: (1) to install stuff on your computer and (2) to create a special Unix user account named (by default) 'postgres'.

Re: [GENERAL] Heavy queries not run by user application

2011-02-14 Thread Ruben Blanco
Thanks a lot, guys. There were two users running Navicat, and these killer queries are indeed run by this program. Rubén. 2011/2/13 John R Pierce pie...@hogranch.com On 02/12/11 5:11 PM, Ruben Blanco wrote: Hi: I'm running a Postgres database with a total disk occupation of 100Gb, largest

[GENERAL] Embedded C function returning a set of rows

2011-02-14 Thread Alessandro Candini
I have read http://www.postgresql.org/docs/9.0/static/xfunc-c.html, but it is not clear to me how to implement a function which retrieve a set of rows. In the example given it seems that I have to recall my function for every row, but this is not what I want. With libpq I can perform a query

Re: [GENERAL] Embedded C function returning a set of rows

2011-02-14 Thread Merlin Moncure
On Mon, Feb 14, 2011 at 7:41 AM, Alessandro Candini cand...@meeo.it wrote: I have read http://www.postgresql.org/docs/9.0/static/xfunc-c.html, but it is not clear to me how to implement a function which retrieve a set of rows. In the example given it seems that I have to recall my function for

Re: [GENERAL] SELECT INTO array[i] with PL/pgSQL

2011-02-14 Thread Merlin Moncure
On Mon, Feb 7, 2011 at 3:15 PM, Julia Jacobson julia.jacob...@arcor.de wrote: Dear PostgreSQL community, Please consider the following minimal example: CREATE TABLE example (row_id SERIAL, value TEXT); INSERT INTO example(value) VALUES ('val1'); INSERT INTO example(value) VALUES ('val2');

Re: [GENERAL] SELECT INTO array[i] with PL/pgSQL

2011-02-14 Thread Dmitriy Igrishin
2011/2/14 Merlin Moncure mmonc...@gmail.com On Mon, Feb 7, 2011 at 3:15 PM, Julia Jacobson julia.jacob...@arcor.de wrote: Dear PostgreSQL community, Please consider the following minimal example: CREATE TABLE example (row_id SERIAL, value TEXT); INSERT INTO example(value) VALUES

[GENERAL] Logging planner estimates.

2011-02-14 Thread pasman pasmański
Hi. Is it possible to log plans which planner discard? I want to tune planner settings for some queries. -- pasman -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Revoking Function Execute Privilege

2011-02-14 Thread David Johnston
I've executed the following in a clean database: As postgres/superuser: CREATE ROLE impotent NOLOGIN; CREATE FUNCTION testfunc() RETURNS boolean AS $$ BEGIN RETURN true; END; $$ LANGUAGE 'plpgsql'; REVOKE ALL ON FUNCTION testfunc() FROM impotent; SET ROLE impotent;

Re: [GENERAL] Revoking Function Execute Privilege

2011-02-14 Thread Tom Lane
David Johnston pol...@yahoo.com writes: REVOKE ALL ON FUNCTION testfunc() FROM impotent; This does not get rid of the default public execute permissions on the function. To limit execute rights, you first have to REVOKE ALL ON FUNCTION testfunc() FROM PUBLIC; and then grant rights back to the

[GENERAL] Using Bitmap scan instead of Seq scan

2011-02-14 Thread Ahmed Ossama
Greetings guys, I am running PostgreSQL 8.4, my database is 60GB. My problem is that there are some queries run extremely fast (when bitmap scan is used), while others take more than 600secs to respond (when seq scan is used). Here is a sample of the queries which uses seq scan...

Re: [GENERAL] Using Bitmap scan instead of Seq scan

2011-02-14 Thread David Johnston
You cannot ALWAYS do an indexed scan - sometimes the only option for the parser is to do a sequential scan (thus you can say avoid unless you have to but you can never truly disable sequential scanning). Given limited knowledge of full-text searching I cannot explain why this specific query is

Re: [GENERAL] Using Bitmap scan instead of Seq scan

2011-02-14 Thread Jon Nelson
On Mon, Feb 14, 2011 at 11:57 AM, David Johnston pol...@yahoo.com wrote: You cannot ALWAYS do an indexed scan - sometimes the only option for the parser is to do a sequential scan (thus you can say avoid unless you have to but you can never truly disable sequential scanning). Does this

Re: [GENERAL] Using Bitmap scan instead of Seq scan

2011-02-14 Thread Tom Lane
Jon Nelson jnelson+pg...@jamponi.net writes: Does this suggest that the config items disable_seqscan (and friends) should be renamed to avoid_seqscan ? Some of them actually are disable, some are only avoid. The documentation says which is which, but I don't think creating a distinction at the

Re: [GENERAL] Multithreaded query onto 4 postgresql instances

2011-02-14 Thread Alban Hertroys
On 14 Feb 2011, at 9:38, Alessandro Candini wrote: I performed tests with a query returning more or less 10 records and using my C module I obtain the following results (every test performed cleaning cache before): - single db: 9.555 sec - splitted in 4: 5.496 sec Is that a single

[GENERAL]

2011-02-14 Thread Edwin Giraldo
i was using holdem manager and my for some reason it said that i coudlnt connect to my postgres so i tried uninstalling postgres and installing it again, but i received a message saing that i could connect to the logon server please help i have team viewer if anyone can help me

Re: [GENERAL] Multithreaded query onto 4 postgresql instances

2011-02-14 Thread Allan Kamau
On Mon, Feb 14, 2011 at 10:38 AM, Alessandro Candini cand...@meeo.it wrote: No, this database is on a single machine, but a very powerful one. Processors with 16 cores each and ssd disks. I already use partitioning and tablespaces for every instance of my db and I gain a lot with my splitted

Re: [GENERAL] SELECT INTO array[i] with PL/pgSQL

2011-02-14 Thread Merlin Moncure
On Mon, Feb 14, 2011 at 8:37 AM, Dmitriy Igrishin dmit...@gmail.com wrote: 2011/2/14 Merlin Moncure mmonc...@gmail.com On Mon, Feb 7, 2011 at 3:15 PM, Julia Jacobson julia.jacob...@arcor.de wrote: Dear PostgreSQL community, Please consider the following minimal example: CREATE TABLE

[GENERAL] Alter Default Privileges Does Not Work For Functions

2011-02-14 Thread David Johnston
After creating and logging into a new database run this script. The initial ALTER DEFAULT PRIVILEGES should make all users unable to execute functions unless given explicit permissions elsewhere. However, the first call to testfunc() succeeds. When I explicitly REVOKE ALL for the specific

[GENERAL] Building extensions on Windows using VS2008

2011-02-14 Thread deepak
Hi! I was trying to build PostgreSQL 9.0.1 using VS2008. I am having problems building the C extensions. I could build the main package, though. Although, I can get a DLL by including the header files from postgres, that DLL is quite not usable. When I try to create a function inside psql, I

Re: [GENERAL] Alter Default Privileges Does Not Work For Functions

2011-02-14 Thread Tom Lane
David Johnston pol...@yahoo.com writes: After creating and logging into a new database run this script. The initial ALTER DEFAULT PRIVILEGES should make all users unable to execute functions unless given explicit permissions elsewhere. You haven't read the fine manual very closely. It saith

[GENERAL] Speeding up index scans by truncating timestamp?

2011-02-14 Thread Derrick Rice
Hey folks, I've got a table of historical events that 10 million rows over 18+ months. Currently there is an index for the event timestamp. I'm wondering if someone can respond to my curiosity regarding the performance of indexes (BTree). Would creating an index on the timestamp truncated to

Re: [GENERAL] How to create index on only some of the rows

2011-02-14 Thread Jasen Betts
On 2011-02-07, A B gentosa...@gmail.com wrote: Hello. How do you create an index for only some of the rows in a table? I read in the docs: The expression used in the WHERE clause can refer only to columns of the underlying table, but it can use all columns, not just the ones being

Re: [GENERAL] Alter Default Privileges Does Not Work For Functions

2011-02-14 Thread David Johnston
I understand now; it wasn't the reading that was causing me problems it was figuring out the implications of the structure of the default privileges system. I suggest that ALTER DEFAULT PRIVILEGES (and probably REVOKE) raise a notice when attempting to REVOKE a [DEFAULT] PRIVILEGE that does not

Re: [GENERAL]

2011-02-14 Thread Craig Ringer
On 15/02/11 00:55, Edwin Giraldo wrote: i was using holdem manager and my for some reason it said that i coudlnt connect to my postgres so i tried uninstalling postgres and installing it again, but i received a message saing that i could connect to the logon server please help i have team

Re: [GENERAL] Building extensions on Windows using VS2008

2011-02-14 Thread Craig Ringer
On 15/02/11 06:28, deepak wrote: Hi! I was trying to build PostgreSQL 9.0.1 using VS2008. I am having problems building the C extensions. I could build the main package, though. The easiest way to do it on Windows is to make a new `contrib' module and compile as part of the main build.

[GENERAL] database design

2011-02-14 Thread Kalai R
hi, We are going to design database for a large company, which has many branches. In each branch they maintain data separately and also they maintain year wise data. ie Company | Branch | Yearly Also we need to compare and prepare reports by combine all branched data. How should

Re: [GENERAL] database design

2011-02-14 Thread John R Pierce
On 02/14/11 10:45 PM, Kalai R wrote: hi, We are going to design database for a large company, which has many branches. In each branch they maintain data separately and also they maintain year wise data. ie Company | Branch | Yearly Also we need to compare and prepare reports

Re: [GENERAL] database design

2011-02-14 Thread Sim Zacks
Hi Kalai, From the vagueness of your question, it sounds like you need a DBA to design the database. But basically you need to put the branch id as a foreign key in all data tables and then you can generate reports grouped by date or portion thereof, branch or company. Sim On