Re: [SQL] Query becoming slower on adding a primary key [ SOLVED

2004-06-10 Thread Rajesh Kumar Mallah
HI, The problem was solved by reducing the effective_cache_size from 102400 to 10240 my total RAM is 4GB. Regds mallah. Tom Lane wrote: [EMAIL PROTECTED] writes: tradein_clients=# explain analyze select email_id ,email ,contact from t_a a join email_source f using(email_id) j

[SQL] (No Subject)

2004-06-10 Thread William Anthony Lim
is it possible to dump within procedural language/SQL syntax? Using pg_dump from console is very confusing for some end user who don't have Linux skills. so I decide to create a function to do that, and they may call it from my application. Thanks William Need a new email address that people

Re: [SQL] Converting integer to binary

2004-06-10 Thread Bruno Wolff III
On Thu, Jun 10, 2004 at 13:24:15 -0700, Chris Gamache <[EMAIL PROTECTED]> wrote: Following up on the cast to bit idea, he could do something like casting to bit(32). I don't think there is an easy way to get this cast to string, so it may not completely solve his problem, depending on what he wa

Re: [SQL] Converting integer to binary

2004-06-10 Thread Chris Gamache
Once upon a time in PostgreSQL there was a function : bitfromint4 ... Any idea where it has disappeared to? You can do # select B'10101101'::int4; int4 -- 173 (1 row) but you want to go # select 173::varbit; which is what bitfromint4 used to do. CG --- Bruno Wolff III <[EMAIL PROTECT

Re: [SQL] Converting integer to binary

2004-06-10 Thread Bruno Wolff III
On Thu, Jun 10, 2004 at 14:52:41 +0100, Stephen Quinney <[EMAIL PROTECTED]> wrote: > > I have searched around but I cannot see any standard way in PostgreSQL > to convert from an integer into a binary representation. > > Now I have an algorithm to do it so I could write an SQL function, I > gue

Re: [SQL] query optimization

2004-06-10 Thread Franco Bruno Borghesi
I see that attribute project is defined as integer in library, and as varchar(8) in clone. I suspect that's what causing the problem and forcing a seq scan on library. On Thu, 2004-03-04 at 14:56, Charles Hauser wrote: All, I have the following query which is running quite slow on our server

Re: [SQL] Function returns error

2004-06-10 Thread Richard Huxton
Michael Long wrote: ERROR: operator does not exist: character varying == "unknown" HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. CONTEXT: PL/pgSQL function "building_insert" line 14 at if Common mistake, still make it myself on occasion.

Re: [SQL] Schema + User-Defined Data Type Indexing problems...

2004-06-10 Thread Tom Lane
Chris Gamache <[EMAIL PROTECTED]> writes: > So, is the best-practice for the my_schema tables to reference the > user-defined datatype in the "public" schema? Not necessarily, but if you put it somewhere else you'll want to add the somewhere else to your default search path (probably via ALTER DAT

[SQL] Function returns error

2004-06-10 Thread Michael Long
Hi All, I am a relatively new user to postgres. I have created a function that compiles but generates an error when executed. I know I am overlooking something simple. The function and error are below. CREATE OR REPLACE FUNCTION building_insert(varchar, int4, varchar) RETURNS int4 AS ' /* Retu

Re: [SQL] Schema + User-Defined Data Type Indexing problems...

2004-06-10 Thread Chris Gamache
--- Tom Lane <[EMAIL PROTECTED]> wrote: > In practice I'm not sure that this is really a situation that we need to > fret about, because using a datatype that isn't in your search path has > got notational problems that are orders of magnitude worse than this > one. The functions and operators tha

Re: [SQL] Find out whether a view's column is indexed?

2004-06-10 Thread Karsten Hilbert
> and I can see whether a sequential scan or an index scan is > performed, but parsing the output of EXPLAIN programmatically > is nearly impossible. Anyway the words 'Index Scan' and 'Seq > Scan' can change without notice, maybe even from one locale to > another. I think you are operating under th

Re: [SQL] Schema + User-Defined Data Type Indexing problems...

2004-06-10 Thread Tom Lane
Chris Gamache <[EMAIL PROTECTED]> writes: > Is it even possible to create an index that lives in a different > schema from the table it is indexing? It is not --- the index always lives in the same schema as its table. However, I think that the real issue here is "where is the datatype?". I'm assu

Re: [SQL] Find out whether a view's column is indexed?

2004-06-10 Thread Martin Schäfer
I think the information_schema.view_column_usage doesn't tell me which view column is based on which table column, it only says generally which set of table/view columns are used for the view as a whole. I need a bit more detailed information. If I have two views defined as this: CREATE VIEW v1

[SQL] Converting integer to binary

2004-06-10 Thread Stephen Quinney
I have searched around but I cannot see any standard way in PostgreSQL to convert from an integer into a binary representation. i.e. I want to do: 16 ==> 1 32 ==> 10 64 ==> 100 96 ==> 110 etc.. Now I have an algorithm to do it so I could write an SQL function, I guess. If there

Re: [SQL] Schema + User-Defined Data Type Indexing problems...

2004-06-10 Thread Chris Gamache
--- Tom Lane <[EMAIL PROTECTED]> wrote: > Chris Gamache <[EMAIL PROTECTED]> writes: > > I'm having a heck of a time, and it seems like in my thrashing about > > to find a solution to this problem I have ruined the uniqueidentifier > > datatype in the schema... > > > CREATE INDEX mt_uuid_idx > >

[SQL] sub-select parameter problem

2004-06-10 Thread Philippe Lang
Hello, Imagine the following query: --- SELECT tableA.field1, tableA.field2, tableB.field1, tableB.field2, ( SELECT tableC.field2 FROM tableC WHERE tableC.field1 = tableB.field1 - 1; ) AS p FROM tableA INNER JOIN tableB ON tabl

Re: [SQL] Find out whether a view's column is indexed?

2004-06-10 Thread Richard Huxton
Martin Schäfer wrote: Is there any way to find out whether a column that's used in a view is indexed? The following query: SELECT ic.relname AS index_name [snip] lets me find out whether a table column is indexed, but it doesn't work for views. Is there anything that can be done for views? At le

[SQL] Find out whether a view's column is indexed?

2004-06-10 Thread Martin Schäfer
Is there any way to find out whether a column that's used in a view is indexed? The following query: SELECT ic.relname AS index_name FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a, pg_opclass oc, pg_namespace n WHERE i.indrelid = bc.oid AND i.indexrelid