[GENERAL] arrays, inline to pointer

2016-05-03 Thread Marcus Engene
Hi, I have some whopper tables for machine learning. One table has a handful of 200-500 double precision arrays (representing feature vectors). It's a 9.5 on a SSD (over USB3). Each table has 5-15M rows in them. For each array I've added, and populated, any dealings with the table has

[GENERAL] efficient math vector operations on arrays

2015-12-23 Thread Marcus Engene
Hi, Are there highly efficient C extensions out there for math operations on arrays? Dot product and whatnot. Example usecase: sort an item by euclid distance. Kind regards, Marcus -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] efficient math vector operations on arrays

2015-12-23 Thread Marcus Engene
On 24/12/15 07:13, Pavel Stehule wrote: Hi 2015-12-24 8:05 GMT+01:00 Marcus Engene <meng...@engene.se <mailto:meng...@engene.se>>: Hi, Are there highly efficient C extensions out there for math operations on arrays? Dot product and whatnot. what you mean "

[GENERAL] Trigger to a queue for sending updates to a cache layer

2014-08-20 Thread Marcus Engene
Hi, I'm working with a retail site with tens of millions of products in several languages. For the detail pages, we try to cache in memcached. We also have quite a bit of keyword translation lookups (for international queries to solr). We're thinking of adding a nosql layer that takes the

[GENERAL] copy expensive local view to an RDS instance

2014-05-06 Thread Marcus Engene
Hi, I have a local db behind a firewall etc. Basically, I'd like to do what I'd locally would... create table abc as select * from local_expensive_view; abc - on RDS local_expensive_view - on local machine How would you go about doing this? Thanks, Marcus -- Sent via

Re: [GENERAL] copy expensive local view to an RDS instance

2014-05-06 Thread Marcus Engene
On 06/05/14 16:58, bricklen wrote: A very quick search shows that rds supports dblink, so perhaps that would work. http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html Then I'd need to open our servers to external visits. It would be lovely if dblink_exec could push a

Re: [GENERAL] copy expensive local view to an RDS instance

2014-05-06 Thread Marcus Engene
On 06/05/14 17:15, bricklen wrote: On Tue, May 6, 2014 at 8:07 AM, Marcus Engene meng...@engene.se mailto:meng...@engene.se wrote: On 06/05/14 16:58, bricklen wrote: A very quick search shows that rds supports dblink, so perhaps that would work. http

[GENERAL] insert data over dblink from bulk select of local table

2014-03-25 Thread Marcus Engene
Hi, I have a production database with some heavy views. I'd like to make a hourly cron (or smth) that bulk inserts new entries into a table on RDS. It's easy to get data down to the prod side, but is it possible to do a bulk insert the other way around? All examples I've seen adds the data

[GENERAL] varchar lengths

2010-09-21 Thread Marcus Engene
Hi list, In Oracle I can... create table a ( b varchar2(10 chars) ); ...and then, regardless of character encoding and how much space an ascii character vs a รถ takes, 10 characters will fit there. If I do say a web-thing in php I have to do horrors like... if (10 mb_strlen ($b, '8bit')) {

Re: [GENERAL] varchar lengths

2010-09-21 Thread Marcus Engene
On 9/21/10 1:29 , Terry Lee Tucker wrote: On Tuesday, September 21, 2010 07:23:45 Massa, Harald Armin wrote: I recommend to use TEXT as type for that kind of columns. 99 out of 100 theories about this value will never be longer then xx characters fail in the long run. And text, limited

[GENERAL] Plan for in with one argument

2010-07-11 Thread Marcus Engene
Hi List, With automated queries where I have COLUMN IN (), I get a different plan from COLUMN = (). That would make sense if there are several arguments, but in the case with just one argument the penalty can be seveare. One query went from 5s execution time to a few houndreds of mS when I

Re: [GENERAL] Plan for in with one argument

2010-07-11 Thread Marcus Engene
On 7/11/10 12:42 , Alban Hertroys wrote: On 11 Jul 2010, at 11:38, Marcus Engene wrote: Hi List, With automated queries where I have COLUMN IN (), I get a different plan from COLUMN = (). That would make sense if there are several arguments, but in the case with just one argument

[GENERAL] short circuit joins

2009-08-30 Thread Marcus Engene
Hi, -- a select ... from base_table bt left outer join sub_table_1 st1 on (st1.base_table = bt.id) left outer join sub_table_2 st1 on (st2.base_table = bt.id) -- b select ... from base_table bt left outer join sub_table_1 st1 on (bt.objecttype = 1 AND st1.base_table =

[GENERAL] somewhat slow query with subselect

2009-08-25 Thread Marcus Engene
Hi list, I have a table, not that many rows (400k) but with about 55 columns. There are some maintenance selects I want to do (every now and then) that I don't want to add indexes for. select ... from quite_big_table qbt where qbt.owner = 123 AND exists ( select null

Re: [GENERAL] somewhat slow query with subselect

2009-08-25 Thread Marcus Engene
Tom Lane wrote: Marcus Engene meng...@engene.se writes: ... In a case with some 5000 rows belonging to owner 123, this select really takes a long time. Way longer than without the subselect and order by filelength. I agree that with the subselect it would take some extra juice, but in my

Re: [GENERAL] where in (select array)

2008-11-21 Thread Marcus Engene
Richard Huxton wrote: I imagine it's cheaper disk dump wise to do the array thing in this and some other similar usages, and therefore it would be nice to have a non-ugly usage pattern. Don't imagine, test. And then factor in the cost of fiddling around with arrays when you need to

[GENERAL] where in (select array)

2008-11-20 Thread Marcus Engene
Hi List, I have the might_like table that contains products a user might like if he likes the present one (item). CREATE TABLE might_like ( item INTEGER NOT NULL ,created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL ,child INTEGER

Re: [GENERAL] where in (select array)

2008-11-20 Thread Marcus Engene
Richard Huxton wrote: Marcus Engene wrote: Hi List, I have the might_like table that contains products a user might like if he likes the present one (item). CREATE TABLE might_like ( item INTEGER NOT NULL ,created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP

Re: [GENERAL] Stroring html form settings

2008-09-26 Thread Marcus Engene
Dianne Yumul wrote: Hello, I have some html forms that I save the settings into the database, things like which item was selected in the menu and if a checkbox was checked. The table looks like this: user_id | report_id | info

[GENERAL] regexp_replace() [noindex] thing

2008-09-25 Thread Marcus Engene
Hi! I'm using tsearch2 and sometimes there are blocks of text that shouldn't be indexed. There is a trigger function that gathers data from the usual suspects and updates the index. in this trigger, I'd like to exclude thing in a [noindex] tag: select regexp_replace

Re: [GENERAL] regexp_replace() [noindex] thing

2008-09-25 Thread Marcus Engene
Tom Lane wrote: Marcus Engene [EMAIL PROTECTED] writes: I would like to have a function like the above that returns innan klas for this data. I would have expected it to as I use the non greedy version. regression=# select regexp_replace ('innan[noindex]apa[/noindex]klas[noindex

Re: [GENERAL] match an IP address

2008-09-23 Thread Marcus Engene
Phoenix Kiula wrote: If you don't want to store IPs for registered users, I'd use: user_id INTEGER, ip cidr, CONSTRAINT must_have_userstamp CHECK ( user_id IS NOT NULL OR ip IS NOT NULL) ... and yes, I'd use a functional index to look it up, or even a trigger-maintained cache of the

Re: [GENERAL] Getting several columns from subselect with LIMIT 1

2008-09-20 Thread Marcus Engene
Pierre Thibaudeau wrote: I have a PERSONS table. I also have a PROGENY table, which is a many-to-many association table with two foreign keys to the PERSONS table to itself. (In this day and age, not only can an individual have any number of children, but also a person can have any number of

[GENERAL] index on id and created_at

2008-09-11 Thread Marcus Engene
Hi, If I have a table like... CREATE TABLE apa ( objectid SERIAL PRIMARY KEY NOT NULL ,created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL ,somedata text ) WITHOUT OIDS; ...where if rowX har higher objectid than rowY, it is implied that

Re: [GENERAL] stem tsearch2, want different stemmed words

2007-07-01 Thread Marcus Engene
Oleg Bartunov wrote: On Sat, 30 Jun 2007, Marcus Engene wrote: Hi! bond= SELECT to_tsvector('default','animation animal'); to_tsvector - 'anim':1,2 (1 row) bond= Sorry for a silly question, I wonder, how do I override this? I would want different stemmed words

[GENERAL] stem tsearch2, want different stemmed words

2007-06-30 Thread Marcus Engene
Hi! bond= SELECT to_tsvector('default','animation animal'); to_tsvector - 'anim':1,2 (1 row) bond= Sorry for a silly question, I wonder, how do I override this? I would want different stemmed words for these. Best regards, Marcus ---(end of

Re: [GENERAL] performance; disk bad or something?

2007-04-07 Thread Marcus Engene
Tom Lane skrev: Marcus Engene [EMAIL PROTECTED] writes: - Index Scan using apa_item_common_x1 on apa_item_common aic (cost=0.00..4956.68 rows=1174 width=8) (actual time=19.854..9557.606 rows=1226 loops=1) If the table only has 12000 rows then it should never have used

Re: [GENERAL] performance; disk bad or something?

2007-04-07 Thread Marcus Engene
Michael Fuhr skrev: On Sat, Apr 07, 2007 at 09:28:58AM +0200, Marcus Engene wrote: INFO: apa_item_common: removed 9028 row versions in 3651 pages DETAIL: CPU 0.24s/0.36u sec elapsed 30.69 sec. INFO: apa_item_common: found 9028 removable, 12863 nonremovable row versions in 14489 pages

[GENERAL] performance; disk bad or something?

2007-04-06 Thread Marcus Engene
Hi, There are some performance issues I am still confused over. I've got a Linux box, raid1, 1GB memory CPU-wise the server is mostly idle PG 8.0.10, shared_buffers = 1 work_mem = 16348 maintenance_work_mem = 65536 Parameters are tweaked without much difference. The following query is

[GENERAL] speeding up a query

2007-04-03 Thread Marcus Engene
Hi, I'm on 8.0.10 and there is a query I cannot quite get adequately fast. Should it take 2.5s to sort these 442 rows? Are my settings bad? Is my query stupid? Would appreciate any tips. Best regards, Marcus apa= explain analyze apa- select apa- ai.objectid as ai_objectid apa- from

Re: [GENERAL] speeding up a query

2007-04-03 Thread Marcus Engene
Hi again, I was thinking, in my slow query it seems the sorting is the villain. Doing a simple qsort test I notice that: [EMAIL PROTECTED] /cygdrive/c/pond/dev/tt $ time ./a.exe 430 real0m0.051s user0m0.030s sys 0m0.000s [EMAIL PROTECTED] /cygdrive/c/pond/dev/tt $ time ./a.exe

Re: [GENERAL] speeding up a query

2007-04-03 Thread Marcus Engene
Tom Lane skrev: Marcus Engene [EMAIL PROTECTED] writes: Should it take 2.5s to sort these 442 rows? Limit (cost=54.40..54.43 rows=12 width=8) (actual time=2650.254..2651.093 rows=442 loops=1) - Sort (cost=54.40..54.43 rows=12 width=8) (actual time=2650.251..2650.515 rows

[GENERAL] generate_series with month intervals

2007-01-11 Thread Marcus Engene
Hi list, I'd like to generate the latest year dynamically with generate_series. This select works day wise: select date_trunc ('month', now())::date + s.a from generate_series(0, 11) as s(a) I tried this but it didn't work: select date_trunc ('month', now())::date + interval s.a || ' months'

Re: [GENERAL] generate_series with month intervals

2007-01-11 Thread Marcus Engene
Tom Lane skrev: Marcus Engene [EMAIL PROTECTED] writes: I tried this but it didn't work: select date_trunc ('month', now())::date + interval s.a || ' months' from generate_series(0, 11) as s(a) People keep trying that :-(. The typename 'foo' syntax is for a *literal constant* only

Re: [GENERAL] Changes in 8.2's PHP behaviour?

2006-12-19 Thread Marcus Engene
semi-ambivalent skrev: All, I have a simple web page that inserts data into a table in 8.1.5 using PHP4. It's pretty amateurish but gets the job done. A few days ago I upgraded to 8.2 (this is on a FreeBSD system, and I used the port) but when I tried to use the web page this morning I got

Re: [GENERAL] TOAD-like query builder for PostgreSQL?

2006-12-09 Thread Marcus Engene
[EMAIL PROTECTED] skrev: I really like TOAD for building Oracle queries. Is there a TOAD-like, FOSS query builder for PostgreSQL? Hi, I use Toad for Oracle too. pgAdminIII is included Postgres, its good but I prefer pg lightning admin which I've been using daily for almost a year now. It's

Re: [GENERAL] Only MONO/WinForms is a way to go

2006-11-28 Thread Marcus Engene
John DeSoi skrev: There are highly productive IDEs for the Mac with all the goodies you mention. But few are cross-platform. Your statement about Windows desktop market share is correct, but it is not the relevant point. Many people are interested in cross-platform tools because they want

Re: [GENERAL] IN clause

2006-11-24 Thread Marcus Engene
I see we have a C J Date fan on the list! ;-) There is one other case where I personally find nullable columns a good thing: process_me ish flags. When a row is not supposed to be processed that field is null and when a field is null it wont be in the index [at least on Oracle]. Best regards,

Re: [GENERAL] Discover temporary INDEX/TABLE name

2006-11-15 Thread Marcus Engene
Ilja Golshtein skrev: Hello! How could I find out if a temporary table (or index on a temporary table) was created by current session? The problem is something like SELECT COUNT(*) FROM PG_INDEXES WHERE INDEXNAME='tmpind1' does not work since temporary indexes from other sessions are

Re: [GENERAL] encoding advice requested

2006-11-13 Thread Marcus Engene
Rick Schumeyer skrev: I will have to try the WIN1252 encoding. On the client side, my application is a web browser. On the server side, it is php scripts on a linux box. The data comes from copying data from a browser window (pointing to another web site) and pasting it into an html

[GENERAL] tsearch2() with data from other table

2006-11-10 Thread Marcus Engene
Hi, I have a table with items. One field is site_user, which fk:s the user row that owns the item. There are a few fields i throw to tsearch2() via an index right now, but one user wanted his name to be in the search as well. So, what I would want to do is: CREATE FUNCTION euits(int) RETURNS

Re: [GENERAL] tsearch2() with data from other table

2006-11-10 Thread Marcus Engene
Teodor Sigaev skrev: CREATE FUNCTION euits(int) RETURNS text AS 'select username || \' \' || firstname || \' \' || lastname from site_user where objectid = $1;' LANGUAGE SQL; CREATE TRIGGER site_item_fts BEFORE UPDATE OR INSERT ON site_item FOR EACH ROW EXECUTE PROCEDURE tsearch2(idxfti,

Re: [GENERAL] Indices for select count(*)?

2005-12-21 Thread Marcus Engene
Greg Stark wrote: Alexander Scholz [EMAIL PROTECTED] writes: Hi, thank you for your answer. Regarding the performance flow when trying to find out how many records are currently being stored in the table, I don't see how an index should help... Nevertheless we've created an unique index on ID

Re: [GENERAL] fts, compond words?

2005-12-12 Thread Marcus Engene
That a simple case, what about languages as norwegian or german? They has compound words and ispell dictionary can split them to lexemes. But, usialy there is more than one variant of separation: forbruksvaremerkelov forbruk vare merke lov forbruk vare merkelov forbruk varemerke lov

[GENERAL] fts, compond words?

2005-12-05 Thread Marcus Engene
Hi, I use the tsearch full text search with pg 8.0.3. It works great, but I wonder if it's possible to search for compound words? Ie if I search for New York i want to get a match on New York has traffic problems. but not on New axe murderer incident in brittish York. Is this possible? I

Re: [GENERAL] fts, compond words?

2005-12-05 Thread Marcus Engene
Oleg Bartunov wrote: On Mon, 5 Dec 2005, Marcus Engene wrote: Hi, I use the tsearch full text search with pg 8.0.3. It works great, but I wonder if it's possible to search for compound words? Ie if I search for New York i want to get a match on New York has traffic problems