Re: [GENERAL] SORT and Merge Join via Index

2013-08-13 Thread Gavin Flower
On 14/08/13 12:02, Robert James wrote: I noticed that when I have an index on (a,b) of table t, and I do an SELECT * FROM t ORDER BY a ASC, it doesn't use the index. When I create a new index of only a, it does use the index. Why is that? And, more importantly, when I do a query involving a me

Re: [GENERAL] SORT and Merge Join via Index

2013-08-13 Thread Robert James
On 8/13/13, Robert James wrote: > I noticed that when I have an index on (a,b) of table t, and I do an > SELECT * FROM t ORDER BY a ASC, it doesn't use the index. When I > create a new index of only a, it does use the index. Why is that? > > And, more importantly, when I do a query involving a m

Re: [GENERAL] sort order

2011-12-12 Thread Abraham, Danny
neral@postgresql.org Subject: Re: [GENERAL] sort order "Abraham, Danny" writes: > This is exactly what I am trying to do - > To find a CREATE DATABASE statement that will produce a database that has a > binary sorting. Setting its LC_COLLATE to "C" ought to do th

Re: [GENERAL] sort order

2011-12-12 Thread Adrian Klaver
On Monday, December 12, 2011 7:55:37 am Abraham, Danny wrote: > This is exactly what I am trying to do - > To find a CREATE DATABASE statement that will produce a database that has a > binary sorting. http://www.postgresql.org/docs/9.0/interactive/sql-createdatabase.html CREATE DATABASE name [

Re: [GENERAL] sort order

2011-12-12 Thread Tom Lane
"Abraham, Danny" writes: > This is exactly what I am trying to do - > To find a CREATE DATABASE statement that will produce a database that has a > binary sorting. Setting its LC_COLLATE to "C" ought to do that. BTW, as of 9.1 you can control this at finer granularity than database level, see t

Re: [GENERAL] sort order

2011-12-12 Thread Abraham, Danny
@postgresql.org Cc: Abraham, Danny Subject: Re: [GENERAL] sort order On Sunday, December 11, 2011 8:17:41 am Abraham, Danny wrote: > On PG 9.0.4, Windows, Encoding and Collate WIN1252 trying to get a > database to sort according to the ascii order. Example: > Select t from test order by t &g

Re: [GENERAL] sort order

2011-12-12 Thread Adrian Klaver
On Sunday, December 11, 2011 8:17:41 am Abraham, Danny wrote: > On PG 9.0.4, Windows, Encoding and Collate WIN1252 trying to get a > database to sort according to the ascii order. Example: > Select t from test order by t > Should be exactly like > Select t from test order by ascii(t). > > Can it

Re: [GENERAL] Sort Method: external merge

2011-08-25 Thread Ondrej Ivanič
Hi, On 26 August 2011 00:14, Tom Lane wrote: > =?UTF-8?Q?Ondrej_Ivani=C4=8D?= writes: >> work_mem is set to 4 000 000 kb and I do not understand why few >> queries (3 and 5) used disk and the rest fit were able to data into >> memory. > > The on-disk representation of sort data is quite a bit mo

Re: [GENERAL] Sort Method: external merge

2011-08-25 Thread Tom Lane
=?UTF-8?Q?Ondrej_Ivani=C4=8D?= writes: > work_mem is set to 4 000 000 kb and I do not understand why few > queries (3 and 5) used disk and the rest fit were able to data into > memory. The on-disk representation of sort data is quite a bit more compact than the in-memory representation. So where

Re: [GENERAL] sort mem: size in RAM vs size on Disk

2011-03-11 Thread Igor Neyman
> -Original Message- > From: mark [mailto:dvlh...@gmail.com] > Sent: Thursday, March 10, 2011 9:37 AM > To: pgsql-general@postgresql.org > Subject: sort mem: size in RAM vs size on Disk > > Hi all, > > > I am wondering if anyone has any estimates on how much larger > a working set for

Re: [GENERAL] sort mem: size in RAM vs size on Disk

2011-03-10 Thread mark
On Thu, Mar 10, 2011 at 8:03 AM, Peter Geoghegan wrote: > What version of PostgreSQL are you using? sort_mem is now called > work_mem (to better reflect the reality that it isn't just used in > sorting, I think), and has been for some time. > > -- > Peter Geoghegan       http://www.2ndQuadrant.com

Re: [GENERAL] sort mem: size in RAM vs size on Disk

2011-03-10 Thread Peter Geoghegan
What version of PostgreSQL are you using? sort_mem is now called work_mem (to better reflect the reality that it isn't just used in sorting, I think), and has been for some time. -- Peter Geoghegan       http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training and Services --

Re: [GENERAL] Sort method: external merge

2009-02-04 Thread Jeff Davis
On Wed, 2009-02-04 at 02:15 -0800, wstrzalka wrote: > Isn't it possible to sort only fields that order matters & some row > identifier/position (don't really know what - oid/ctid are tight to > table but something temporary tight to 'resultset')? It would take > much less memory and could be proces

Re: [GENERAL] sort a referenced list

2006-04-06 Thread Jim Nasby
On Apr 4, 2006, at 3:22 PM, Matthew Peter wrote: Tom Lane <[EMAIL PROTECTED]> wrote: Matthew Peter writes: > What I'm trying to do is create a function that accepts a list then sorts and groups the values (like in sql)... I will have an unique list I can convert it to an array later or leave

Re: [GENERAL] sort a referenced list

2006-04-04 Thread Matthew Peter
Tom Lane <[EMAIL PROTECTED]> wrote: Matthew Peter writes:> What I'm trying to do is create a function that accepts a list then sorts and groups the values (like in sql)... I will have an unique list I can convert it to an array later or leave it a listThere is no "list" data structure in SQL.

Re: [GENERAL] sort a referenced list

2006-04-04 Thread Tom Lane
Matthew Peter <[EMAIL PROTECTED]> writes: > What I'm trying to do is create a function that accepts a list then sorts > and groups the values (like in sql)... I will have an unique list I can > convert it to an array later or leave it a list There is no "list" data structure in SQL. There a

Re: [GENERAL] sort a referenced list

2006-04-04 Thread Matthew Peter
I'll help clarify exactly what I am trying to accomplish. What I'm trying to do is create a function that accepts a list then sorts and groups the values (like in sql)... I will have an unique list I can convert it to an array later or leave it a listI'd like to keep it simple and manipul

Fwd: Re: [GENERAL] sort character data in arbitrary order?

2006-01-14 Thread Robert Paulsen
On Saturday 14 January 2006 14:06, Andrew - Supernews wrote: > On 2006-01-14, Robert Paulsen <[EMAIL PROTECTED]> wrote: > > Here is my query so far: > > > > SELECT foo, bar, baz, FROM my_table WHERE state ~ '[abc]' > > ORDER BY state ASC LIMIT 1. > > > > This works as expected. My problem

Re: [GENERAL] sort character data in arbitrary order?

2006-01-14 Thread Robert Paulsen
On Saturday 14 January 2006 14:10, Michael Fuhr wrote: > On Sat, Jan 14, 2006 at 01:38:52PM -0600, Robert Paulsen wrote: > > SELECT foo, bar, baz, FROM my_table WHERE state ~ '[abc]' > > ORDER BY state ASC LIMIT 1. > > > > This works as expected. My problem is that I am relying on the colla

Re: [GENERAL] sort character data in arbitrary order?

2006-01-14 Thread Michael Fuhr
On Sat, Jan 14, 2006 at 01:38:52PM -0600, Robert Paulsen wrote: > > SELECT foo, bar, baz, FROM my_table WHERE state ~ '[abc]' > ORDER BY state ASC LIMIT 1. > > This works as expected. My problem is that I am relying on the collating > sequence of the letters a-z and the desirability

Re: [GENERAL] sort character data in arbitrary order?

2006-01-14 Thread Andrew - Supernews
On 2006-01-14, Robert Paulsen <[EMAIL PROTECTED]> wrote: > Here is my query so far: > > SELECT foo, bar, baz, FROM my_table WHERE state ~ '[abc]' > ORDER BY state ASC LIMIT 1. > > This works as expected. My problem is that I am relying on the collating > sequence of the letters a-z and

Re: [GENERAL] sort array optimisation in pl/perl

2005-03-25 Thread Ragnar Hafstað
On Fri, 2005-03-25 at 15:29 +0100, GIROIRE Nicolas (COFRAMI) wrote: [re-arranged] > [mailto:[EMAIL PROTECTED] la part de Ragnar Hafstað > > On Thu, 2005-03-24 at 15:49 +0100, GIROIRE Nicolas (COFRAMI) wrote: > > > > I create an array which is result of query on postgresql database > and > > >

Re: [GENERAL] sort array optimisation in pl/perl

2005-03-25 Thread GIROIRE Nicolas (COFRAMI)
Title: RE: [GENERAL] sort array optimisation in pl/perl Hi, thanks for this help. The method functions great but the profit of time is good just if I have a lot of elements to deplace.     COFRAMI     Nicolas Giroire     on behalf of AIRBUS France     for In Flight

Re: [GENERAL] sort array optimisation in pl/perl

2005-03-24 Thread Ragnar Hafstað
On Thu, 2005-03-24 at 15:49 +0100, GIROIRE Nicolas (COFRAMI) wrote: > I create an array which is result of query on postgresql database and > then I want to sort rows in a particular way (impossible by query on > database). can you give us more details on this particular sort order? > My solutio

Re: [GENERAL] Sort memory not being released

2003-06-20 Thread Mike Castle
In article <[EMAIL PROTECTED]>, Jim C. Nasby <[EMAIL PROTECTED]> wrote: >Of course I wasn't planning on sucking down a bunch of memory and >holding on to it. :) What are you worried about? The unused portions will eventually be paged out to disk. On the next sort, you'll spend a little less time

Re: [GENERAL] Sort by foreign date column

2001-08-21 Thread Tom Lane
"Andrey Y. Mosienko" <[EMAIL PROTECTED]> writes: >> If DD/MM/ is not close enough for you, maybe the right answer is to >> add another DateStyle. > Sorry for disturbing, but how can I do this or where is it in documentation? It's not documented; you'd have to dig into the code and see how th

Re: [GENERAL] Sort by foreign date column

2001-08-21 Thread Andrey Y. Mosienko
Tom Lane wrote: > > > On Tue, 21 Aug 2001, Andrey Y. Mosienko wrote: > > But in Russia we have the next date format: DD-MM-. > > Just setting DateStyle to 'SQL' would get you approximately what you > want: > > regression=# set DateStyle TO SQL; > SET VARIABLE > regression=# select now(); >

Re: [GENERAL] Sort by foreign date column

2001-08-21 Thread Mike Mascari
omid omoomi wrote: > > and how about this: > > SELECT TO_CHAR(chdate, 'DD-MM-') > FROM mytable > ORDER BY chdate::date; Yes, but Andrey says that the chdate field is declared as a date: > > > > On Tue, 21 Aug 2001, Andrey Y. Mosienko wrote: > > > > > > > > > > > > > > I have table with dat

Re: [GENERAL] Sort by foreign date column

2001-08-21 Thread omid omoomi
and how about this: SELECT TO_CHAR(chdate, 'DD-MM-') FROM mytable ORDER BY chdate::date; >From: Mike Mascari <[EMAIL PROTECTED]> >To: "Andrey Y. Mosienko" <[EMAIL PROTECTED]> >CC: Stephan Szabo <[EMAIL PROTECTED]>, Postgres ><[EMAI

Re: [GENERAL] Sort by foreign date column

2001-08-21 Thread Mike Mascari
"Andrey Y. Mosienko" wrote: > > Stephan Szabo wrote: > > > > On Tue, 21 Aug 2001, Andrey Y. Mosienko wrote: > > > > > > > > I have table with date type column: > > > > > > chdate date; > > > > > > SELECT chdate from mytable; > > > > > >chdate > > > 1999-01-02 > > > > > > But in Russia we hav

Re: [GENERAL] Sort

2000-07-21 Thread Mitch Vincent
- Original Message - From: "Nathan Barnett" <[EMAIL PROTECTED]> To: "'Mitch Vincent'" <[EMAIL PROTECTED]> Sent: Friday, July 21, 2000 3:03 PM Subject: RE: [GENERAL] Sort > Here is the query: > > SELECT Impression.AdNu