Re: [GENERAL] Query optimisation

2008-04-06 Thread Craig Ringer
Naz Gassiep wrote: > As you can see, they all are the same table, just repeatedly joined with > aliases. Sorry, I'm obviously blind. -- Craig Ringer -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pg

Re: [GENERAL] select distinct and index usage

2008-04-06 Thread Alban Hertroys
On Apr 7, 2008, at 1:32 AM, David Wilson wrote: I have a reasonably large table (~75m rows,~18gb) called "vals". It includes an integer datestamp column with approximately 4000 unique entries across the rows; there is a normal btree index on the datestamp column. When I attempt something like "se

Re: [GENERAL] Query optimisation

2008-04-06 Thread Naz Gassiep
As you can see, they all are the same table, just repeatedly joined with aliases. The images table has several fields, each one referring to a different sized version of the image. It then has to join against the files table for each size to get the file that corresponds with that image version

Re: [GENERAL] Query optimisation

2008-04-06 Thread Tom Lane
Craig Ringer <[EMAIL PROTECTED]> writes: > That's a whole lot of joins. See join_collapse_limit ... regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-gene

Re: [GENERAL] Query optimisation

2008-04-06 Thread Craig Ringer
Naz Gassiep wrote: > JOIN files imageid_file ON (images.imageid = > imageid_file.fileid) > JOIN files size120_file ON (images.size120 = > size120_file.fileid) > JOIN files size240_file ON (images.size240 = > size240_file.fileid) > JOI

Re: [GENERAL] Removing Context messages

2008-04-06 Thread Tom Lane
"Fernando Hevia" <[EMAIL PROTECTED]> writes: > I want to get rid of the CONTEXT messages. > I have tried in psql with "\set VERBOSITY terse" without success. Works for me ... regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

[GENERAL] Removing Context messages

2008-04-06 Thread Fernando Hevia
Hi list, I'm having trouble removing some context messages in psql and/or pgadmin. I made a simple example to show this with 2 functions: f_outer which loops through a recordset and calls f_inner for each record. Context messages appear only when the f_inner function logs. (Would be nice to kno

[GENERAL] Query optimisation

2008-04-06 Thread Naz Gassiep
The following query is executing in a long time, 500ms or so. This needs to be about 100ms or so in order to be acceptable. Can anyone spot any optimisations that I could make to this query to bring the exec time down? Have I designed this query correctly? Is joining to the same table every time

[GENERAL] calendar best practices for postgres

2008-04-06 Thread Tim Uckun
Does anybody know of an open source application which leverages postgres to build a scheduling/calendaring application. Especially if it uses some of the datetime types and functions that are unique to postgres. I am specifically interested in methods to deal with recurring events and dealing with

Re: [GENERAL] select distinct and index usage

2008-04-06 Thread David Wilson
Both tables are vacuumed and analyzed. I have other queries that are using various indices on the vals table in an intelligent fashion. I can try increasing the stats, certainly, although they're at the defaults for both tables. The variation is definitely identical- the set of datestamps in the v

Re: [GENERAL] select distinct and index usage

2008-04-06 Thread Craig Ringer
David Wilson wrote: On another table in the same database with a much smaller number of total rows (~15m rows), I have the exact same situation- but in this case the index on the datestamp column *is* used: Have you run ANALYZE on both tables? It might be worth increasing the stats collected

Re: [GENERAL] pl/pgsql RECORD data type, how to access to the values

2008-04-06 Thread Guillaume Bog
On Mon, Apr 7, 2008 at 1:56 AM, Craig Ringer <[EMAIL PROTECTED]> wrote: > Guillaume Bog wrote: > > > I want a table to be "read-only", so I raise exceptions with a before > > trigger on update, insert and delete. It works well. > > > > This read-only table is modified (delete + insert) by a tri

[GENERAL] Preparing full text search input for use in PostgreSQL 8.3

2008-04-06 Thread Rudolph
Hi, It's nice that we have plainto_tsquery in addition to to_tsquery because it's syntax is closer to what end users are used to (more like Google search syntax with it's implicit "AND"). plainto_tsquery however "cannot recognize either Boolean operators or weight labels" (see: http://www.postgre

[GENERAL] select distinct and index usage

2008-04-06 Thread David Wilson
I have a reasonably large table (~75m rows,~18gb) called "vals". It includes an integer datestamp column with approximately 4000 unique entries across the rows; there is a normal btree index on the datestamp column. When I attempt something like "select distinct datestamp from vals", however, expla

Re: [GENERAL] slow pgsql tables - need to vacuum?

2008-04-06 Thread Gregory Stark
"Craig Ringer" <[EMAIL PROTECTED]> writes: > Douglas McNaught wrote: > >> You need to ANALYZE the tables after you load them, and make sure you >> have indexes on the column you're querying (which it sounds like you >> do, but they're not being used because the statistics for the table >> are inac

Re: [GENERAL] pl/pgsql RECORD data type, how to access to the values

2008-04-06 Thread Craig Ringer
Guillaume Bog wrote: > I want a table to be "read-only", so I raise exceptions with a before > trigger on update, insert and delete. It works well. > > This read-only table is modified (delete + insert) by a trigger > function set on another table, but this second trigger calls the first > and I

Re: [GENERAL] slow pgsql tables - need to vacuum?

2008-04-06 Thread Craig Ringer
Douglas McNaught wrote: > You need to ANALYZE the tables after you load them, and make sure you > have indexes on the column you're querying (which it sounds like you > do, but they're not being used because the statistics for the table > are inaccurate). I've seen discussion here that made it so

Re: [GENERAL] Silent install 8.3 diiffers from 8.2

2008-04-06 Thread Craig Ringer
[EMAIL PROTECTED] wrote: > With postgresql-8.3-int.msi I always run into the following security > error: > > "Service 'PostgreSQL Database Server 8.3' (pgsql-8.3) failed to start. > Verify that you have sufficient privileges to start system services." What are the full details from the system e

Re: [GENERAL] drop database regardless of connections

2008-04-06 Thread Craig Ringer
Kev wrote: > So I tried to do this in Perl, but for some reason neither > kill() nor Win32::Process::KillProcess() actually terminate the > threads. Threads? Each backend is a distinct process. I haven't the foggiest why they might be ignoring the signal, but then I'm very far from clueful about

Re: [GENERAL] Numbering rows by date

2008-04-06 Thread Volkan YAZICI
On Wed, 2 Apr 2008, "Andrus" <[EMAIL PROTECTED]> writes: > create Document ( docdate date, docorder integer ) > > I need update docorder column with numbers 1,2 in docdate date order > Something like > > i = 1; > UPDATE Document SET docorder = i++ > ORDER BY docdate; CREATE SEQUENCE document_doc

[GENERAL] Using tsearch2 in a Bayesian filter

2008-04-06 Thread Alban Hertroys
Hi all, In my spare time I've started on a general purpose Bayesian filter based on the now built-in tsearch2 functionality. The ability to stem words from a message into lexemes, removing stop words and gist indexes look promising enough to attempt this. However, my experience with tsear

Re: [GENERAL] Numbering rows by date

2008-04-06 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Andrus" <[EMAIL PROTECTED]> writes: > I have table > create Document ( docdate date, docorder integer ) > I need update docorder column with numbers 1,2 in docdate date order > Something like > i = 1; > UPDATE Document SET docorder = i++ > ORDER BY docdate; >

Re: [GENERAL] pl/pgsql RECORD data type, how to access to the values

2008-04-06 Thread Pavel Stehule
> > This read-only table is modified (delete + insert) by a trigger > function set on another table, but this second trigger calls the first > and I can modify my read-only table. I'd like my "read-only" trigger > to be aware that the modification call on the read-only table comes > from the s