Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XBPY3-0000dg-TQ for pgsql-performance@arkaria.postgresql.org; Sun, 27 Jul 2014 14:35:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XBPY2-0001eI-TP for pgsql-performance@arkaria.postgresql.org; Sun, 27 Jul 2014 14:35:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XBPY1-0001eB-M3 for pgsql-performance@postgresql.org; Sun, 27 Jul 2014 14:35:37 +0000 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XBPXt-0000CL-Eq for pgsql-performance@postgresql.org; Sun, 27 Jul 2014 14:35:36 +0000 Received: by mail-wi0-f179.google.com with SMTP id f8so3156373wiw.12 for ; Sun, 27 Jul 2014 07:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type:thread-index:content-language; bh=uJaZt38187qVyXKetbQCTYpPa3GGGfS9T5N1dkowO5g=; b=io8bUWtIha+KcI94JaxfItzWXIrxoMB0JtUzPcdULYBZrB48FJK0xXPl+JJDAypJTb CJ+DbDz5aipsfRW/a8OMepeJK9sb5V2qn3IL8BpHh5pQWAZfFGl7rqzBBx/JWmd4sT9k yMRwT7foUSg9GEWkkv3llWICFmg0g+27Gv41nnGcqGJGsld6NchNrdvuEUPAcDK5EkcP 94SY97YUrhAq4VMoWVrf7hrsGLq2r0TEf07RWy67D3ZmPdTbg9FopZT7Er4ltCv3/+3p aGlT6aa9U2hGXkTg30ic/n4i9yOi5JFQSSL9yprjfh5j3fVKgo/B5vQCRWWeAzVg9zeY n3Lw== X-Received: by 10.180.184.20 with SMTP id eq20mr20801441wic.37.1406471728103; Sun, 27 Jul 2014 07:35:28 -0700 (PDT) Received: from Astartes (ip-213-220-249-54.net.upcbroadband.cz. [213.220.249.54]) by mx.google.com with ESMTPSA id b9sm8439943wic.23.2014.07.27.07.35.26 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Jul 2014 07:35:27 -0700 (PDT) From: =?UTF-8?B?SmnFmcOtIE7DoWR2b3Juw61r?= To: "'Vitalii Tymchyshyn'" Cc: References: <01d201cfa8be$dd746880$985d3980$@gmail.com> In-Reply-To: Subject: Re: Cursor + upsert (astronomical data) Date: Sun, 27 Jul 2014 16:35:21 +0200 Message-ID: <04b801cfa9a7$ffdcb280$ff961780$@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_04B9_01CFA9B8.C36B75F0" X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHSB3FUPUcQjIVcmXO3GnoQtcDS6gLVq3F8m5iL7yA= Content-Language: cs X-Pg-Spam-Score: -1.0 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org This is a multipart message in MIME format. ------=_NextPart_000_04B9_01CFA9B8.C36B75F0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Vitalii, thank you for your reply. =20 The problem you suggested can in the most pathological way be, that = these observations are on one line. As you suggested it, the B would be = in the middle. So A and C are not in 1 arcsec range of each other, but = they must be within 1 arcsec of their common average coordinates. If the = distances between A,B,C are 1 arcsec for each, the right solution is to = pick B as reference identifier and assign A and C to it. =20 We already tried the approach you suggest with applying a grid based on = the Q3C indexing of the database. We were not just rounding the results, = but using the center of the Q3C =E2=80=9Csquare=E2=80=9D in which the = observation took place. The result was poor however =E2=80=93 22% of the = identifiers were closer to each other than 1 arcsec. That means that = when you crossmatch the original observations to them, you don=E2=80=99t = know which one to use and you have duplicates. The reason for this is = that nearly all of the observations are from SMC (high density of = observations), which causes that you have more than 2 = =E2=80=9Crounded=E2=80=9D positions in a row and don=E2=80=99t know = which ones to join together (compute average coordinates from it). If it = is not clear enough I can draw it on an image for you. Maybe the simple round up would have better results because the squares = are not each the same size and you can scale them only by 2 (2-times = smaller, or larger square). We used a squre with the side cca 0.76 = arcsec which approximately covers the 1 arcsec radius circle. =20 Oh and one more important thing. The difficulty of our data is not that = it is 3e8 rows. But in the highest density, there are cca 1000 images = overlapping. Which kills you when you try to self-join the observations = to find neighbours for each of them =E2=80=93 the quadratic complexity = is based on the overlappingon the image (e.g. 10000 observations on one = image with another 999 images overlapping it means 10000 *1000^2).=20 =20 Best regards, =20 Jiri Nadvornik =20 From: tivv00@gmail.com [mailto:tivv00@gmail.com] On Behalf Of Vitalii = Tymchyshyn Sent: Sunday, July 27, 2014 8:06 AM To: Ji=C5=99=C3=AD N=C3=A1dvorn=C3=ADk Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Cursor + upsert (astronomical data) =20 I am not sure I understand the problem fully, e.g. what to do if there = are observations A,B and C with A to B and B to C less then treshold and = A to C over treshold, but anyway. Could you first apply a kind of grid to your observations? What I mean = is to round your coords to, say, 1/2 arcsec on each axe and group the = results. I think you will have most observations grouped this way and = then use your regular algorithm to combine the results. Best regards, Vitalii Tymchyshyn ------=_NextPart_000_04B9_01CFA9B8.C36B75F0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi Vitalii, thank you for your reply.

 

The problem you suggested can in the most pathological way be, that = these observations are on one line. As you suggested it, the B would be = in the middle. So A and C are not in 1 arcsec range of each other, but = they must be within 1 arcsec of their common average coordinates. If the = distances between A,B,C are 1 arcsec for each, the right solution is to = pick B as reference identifier and assign A and C to = it.

 

We already tried the approach you suggest with applying a grid based = on the Q3C indexing of the database. We were not just rounding the = results, but using the center of the Q3C =E2=80=9Csquare=E2=80=9D in = which the observation took place. The result was poor however =E2=80=93 = 22% of the identifiers were closer to each other than 1 arcsec. That = means that when you crossmatch the original observations to them, you = don=E2=80=99t know which one to use and you have duplicates. The reason = for this is that nearly all of the observations are from SMC (high = density of observations), which causes that you have more than 2 = =E2=80=9Crounded=E2=80=9D positions in a row and don=E2=80=99t know = which ones to join together (compute average coordinates from it). If it = is not clear enough I can draw it on an image for = you.

Maybe the simple round up would have better results because the = squares are not each the same size and you can scale them only by 2 = (2-times smaller, or larger square). We used a squre with the side cca = 0.76 arcsec which approximately covers the 1 arcsec radius = circle.

 

Oh and one more important thing. The difficulty of our data is not = that it is 3e8 rows. But in the highest density, there are cca 1000 = images overlapping. Which kills you when you try to self-join the = observations to find neighbours for each of them =E2=80=93 the quadratic = complexity is based on the overlappingon the image (e.g. 10000 = observations on one image with another 999 images overlapping it means = 10000 *1000^2).

 

Best regards,

 

Jiri Nadvornik

 

From:= = tivv00@gmail.com [mailto:tivv00@gmail.com] On Behalf Of Vitalii = Tymchyshyn
Sent: Sunday, July 27, 2014 8:06 AM
To: = Ji=C5=99=C3=AD N=C3=A1dvorn=C3=ADk
Cc: = pgsql-performance@postgresql.org
Subject: Re: [PERFORM] Cursor = + upsert (astronomical data)

 

I am not sure I understand the = problem fully, e.g. what to do if there are observations A,B and C with = A to B and B to C less then treshold and A to C over treshold, but = anyway.

Could you first apply a kind of grid to your = observations? What I mean is to round your coords to, say, 1/2 arcsec on = each axe and group the results. I think you will have most observations = grouped this way and then use your regular algorithm to combine the = results.

Best regards, Vitalii = Tymchyshyn

------=_NextPart_000_04B9_01CFA9B8.C36B75F0--