Re: [SQL] encoding

2005-05-07 Thread Peter Eisentraut
Aarni Ruuhimäki wrote:
> You might also want (re?)configure your Pg-system with
> --enable-locale and set your preferred locale and db default encoding
> in initdb to suit your needs, in order to have alphabetical sortings
> etc. work ok.

If you're still using a PostgreSQL version that has the --enable-locale 
option then you rather need to upgrade.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [SQL] Discordance between the way select is called.

2005-05-07 Thread Stephan Szabo
> Hi,
>
> I have a java app that uses hibernate to do queries.
>
> One query on a 6.5 millions records takes about 15 seconds while the
> same one (take from the sql that shows in the consol - I configured
> hibernate to show_sql) takes about 50 ms when done with pgadmin3.

We could answer better with explain output.  Something like:

prepare foo(int) as select notevalue0_.id
 as id, notevalue0_.value_note as value2_3_, notevalue0_.actif as
 actif3_, notevalue0_.id_note as id4_3_, notevalue0_.id_field_name as
 id5_3_ from note.note_value notevalue0_ where notevalue0_.id_note=$1 and
 notevalue0_.actif=1;

explain analyze execute foo();


-
As an initial guess, I'd wonder if it's guessing that for an arbitrary
id_note value that it should do a sequence scan.  Are there a large number
of very common id_note values that might be throwing it off?

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [SQL] encoding

2005-05-07 Thread Aarni Ruuhimäki
Hi,

In my experience , I think your best bet and an all-around good general 
encoding to use is latin1, which copes with l'accent egys & graves, umlauts, 
harasoos and others.

Not so sure about the M$-import stuff though. Or asp or .net. Read the Gates 
Private Licence ...

You might also want (re?)configure your Pg-system with --enable-locale and set 
your preferred locale and db default encoding in initdb to suit your needs, 
in order to have alphabetical sortings etc. work ok.

BR,

Aarni


On Friday 06 May 2005 16:50, you wrote:
> I am not clear on what makes this work?
>
>
>
> I am going live Sunday and have thus far been using SQL_ASCHII.
>
> I still have the feeling I should be using something else, but when I used
> Unicode my conversion from MSSQL blew up on encoding error for a char that
> wasn't plain ASCHII(IE French or Spanish etc.).
>
> The conversion program ran fine when I chose SQL_ASCHII.
>
> The data is on a windows 2k MSSQL database.
>
> The conversion program is a .net app that reads from MSSQL win2k data base
> and writes to postgtres 8.0.2 on Redhat AS4.
>
> I tried to get this to work a while back and found if I set the encoding
> explicitly on the connect in the .net connector it did not give me an
> error, but I still have many asp pages and I could not get the encoding set
> using the ODBC (which is what the asp pages use).
>
> I believe I tried setting it with a sql statement, but that did not seem to
> help either.
>
> I can move forward using SQL_ASCHII, but would prefer to have encoding set
> properly, but I ma not sure what I am missing.
>
>
>
> Any ideas would be much appreciated.
>
>
>
> Joel Fradkin


--
This is a bugfree broadcast to you
from **Kmail**
on **Fedora Core 2** linux system
--

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [SQL] select within aggregate?

2005-05-07 Thread Vortex
On Fri, 6 May 2005 07:49:23 -0500
Bruno Wolff III <[EMAIL PROTECTED]> wrote:

> You could use max(ts) as long as you can have two requests occur at the
> same time. This might be a reasonable assumption, but it might have been
> better to include a sequence so that each record would be guaranteed to
> have a unique key.
Yes, of course. So far it was more a theoretical question.

> Using DISTINCT ON to get the latest URIs is probably better. You can
> join that query to the one doing the count. This will probably be more
> efficient than executing a subquery for each remote host.
The DISTINCT ON construction looks quite interesting. It seems to allow
some sorting within an group (even althought it's no real aggregate) in
general. I can't say if it's really more eficient than the solution suggested
by R.Muralidharan. But i will do some tests!

Thank you very much!

Klaus

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings