Re: [SQL] slow query execution

2007-05-31 Thread Richard Huxton
Trigve Siver wrote: - Original Message From: Richard Huxton <[EMAIL PROTECTED]> To: Trigve Siver <[EMAIL PROTECTED]> Sent: Thursday, May 31, 2007 10:33:40 AM Subject: Re: [SQL] slow query execution So - you want something like: The user runs a query ("all blue things

Re: [SQL] slow query execution

2007-05-31 Thread Trigve Siver
Thanks for reply, This solution looks promising. I'll look at it and test it and let you know. Thanks once more Trigve - Original Message From: Richard Huxton <[EMAIL PROTECTED]> To: Trigve Siver <[EMAIL PROTECTED]> Sent: Thursday, May 31, 2007 10:33:40 AM Subjec

Re: [SQL] slow query execution

2007-05-31 Thread Bart Degryse
Sorry, I don't know C++ enough to help you much. I also don't understand your problem well enough. >>> Trigve Siver <[EMAIL PROTECTED]> 2007-05-31 9:46 >>> Hi, thanks for reply No, I'm working with c++ and libpqxx (pgsql c++ binding). I'm using Win32 Listview control with LS_OWNERDATA style. I

Re: [SQL] slow query execution

2007-05-31 Thread Trigve Siver
out 10.000+ records and user want to view/search only first 100 records. thanks Trigve - Original Message From: Bart Degryse <[EMAIL PROTECTED]> To: pgsql-sql@postgresql.org Sent: Thursday, May 31, 2007 9:24:04 AM Subject: Re: [SQL] slow query execution Am I right in assuming tha

Re: [SQL] slow query execution

2007-05-31 Thread Bart Degryse
in the listview. >>> Trigve Siver <[EMAIL PROTECTED]> 2007-05-30 21:11 >>> >- Original Message >From: Richard Huxton <[EMAIL PROTECTED]> >To: Trigve Siver <[EMAIL PROTECTED]> >Cc: pgsql-sql@postgresql.org >Sent: Wednesday, May 30, 2007 9:05:09

Re: [SQL] slow query execution

2007-05-30 Thread Trigve Siver
>- Original Message >From: Richard Huxton <[EMAIL PROTECTED]> >To: Trigve Siver <[EMAIL PROTECTED]> >Cc: pgsql-sql@postgresql.org >Sent: Wednesday, May 30, 2007 9:05:09 PM >Subject: Re: [SQL] slow query execution > >Trigve Siver wrote: >> >&g

Re: [SQL] slow query execution

2007-05-30 Thread Richard Huxton
Trigve Siver wrote: I seee...when new data will be added to table, then row numbers wouldn''t be valid anymore. Hmmm...looked like I need to find other solution. Try explaining what it is you're trying to achieve, and maybe someone will be able to suggest a solution. -- Richard Huxton

Re: [SQL] slow query execution

2007-05-30 Thread Trigve Siver
>- Original Message >From: Andrew Sullivan <[EMAIL PROTECTED]> >To: pgsql-sql@postgresql.org >Sent: Wednesday, May 30, 2007 8:30:32 PM >Subject: Re: [SQL] slow query execution > >On Wed, May 30, 2007 at 11:08:02AM -0700, Trigve Siver wrote: > >> I wan

Re: [SQL] slow query execution

2007-05-30 Thread Andrew Sullivan
On Wed, May 30, 2007 at 11:08:02AM -0700, Trigve Siver wrote: > I want to do it only for some queries. So when I need query like > that "SELECT * from t1" I need to add row_numbers there. So I will > have "query with row_numbers" (where row_numbers are row numbers of > my virtual list view). Then

Re: [SQL] slow query execution

2007-05-30 Thread Trigve Siver
>- Original Message >From: Andrew Sullivan <[EMAIL PROTECTED]> >To: pgsql-sql@postgresql.org >Sent: Wednesday, May 30, 2007 7:39:18 PM >Subject: Re: [SQL] slow query execution > >On Wed, May 30, 2007 at 10:03:16AM -0700, Trigve Siver wrote: >> Hi, Thanks f

Re: [SQL] slow query execution

2007-05-30 Thread Andrew Sullivan
On Wed, May 30, 2007 at 10:03:16AM -0700, Trigve Siver wrote: > Hi, Thanks for reply, As you have mentioned I need to get row > numbers for my query, so when I make some other query with same > data I will know which row number has a particular ID. Oh, wait. If _that's_ your plan, then this will

Re: [SQL] slow query execution

2007-05-30 Thread Trigve Siver
Thanks a lot Trigve - Original Message From: Rodrigo De León <[EMAIL PROTECTED]> To: pgsql-sql@postgresql.org; Trigve Siver <[EMAIL PROTECTED]> Sent: Wednesday, May 30, 2007 7:28:47 PM Subject: Re: [SQL] slow query execution On 5/30/07, Trigve Siver <[EMAIL PROTECTED]>

Re: [SQL] slow query execution

2007-05-30 Thread Rodrigo De León
On 5/30/07, Trigve Siver <[EMAIL PROTECTED]> wrote: Can you point me to some sources or give me some examples, please? CREATE OR REPLACE FUNCTION ROWNUM() RETURNS BIGINT AS $$ BEGIN RETURN NEXTVAL('ROWNUM_SEQ'); EXCEPTION WHEN OTHERS THEN CREATE T

Re: [SQL] slow query execution

2007-05-30 Thread Trigve Siver
e to some sources or give me some examples, please? Thanks Trigve - Original Message From: Andrew Sullivan <[EMAIL PROTECTED]> To: pgsql-sql@postgresql.org Sent: Wednesday, May 30, 2007 6:45:53 PM Subject: Re: [SQL] slow query execution On Wed, May 30, 2007 at 08:56:45AM -07

Re: [SQL] slow query execution

2007-05-30 Thread Andrew Sullivan
On Wed, May 30, 2007 at 08:56:45AM -0700, Trigve Siver wrote: > Hi all, > > This query executes very slow: > > select (select count(*) from customer where id <= a.id) as row, id, > from customer as a order by id; So you are trying to get the ordinal position of every ID in the table? I'm not su

[SQL] slow query execution

2007-05-30 Thread Trigve Siver
Hi all, This query executes very slow: select (select count(*) from customer where id <= a.id) as row, id, from customer as a order by id; Where customer has id column and others and has also index on id column. The table has about 10.000+ records. When used with "explain", it gives me this o