Re: [HACKERS] WIP: index support for regexp search

2012-11-29 Thread er
On Mon, November 26, 2012 20:49, Alexander Korotkov wrote:

> trgm-regexp-0.6.patch.gz

I ran the simple-minded tests against generated data (similar to the ones I did 
in January 2012). 
The problems of that older version seem pretty much all removed. (although I 
didn't do much work
on it -- just reran these tests).

I used two 2 instances, 'HEAD' and 'trgm_regex', which were both compiled with

 '--enable-depend' '--with-openssl' '--with-perl' '--with-libxml'

Tables used:

rowcount size tablesize index (trgm)

 azjunk4   10^4 rows  1,171,456 |   9,781,248
 azjunk5   10^5 rows 11,706,368 |  65,093,632
 azjunk6   10^6 rows117,030,912 | 726,310,912
 azjunk7   10^7 rows  1,170,292,736 |   4,976,189,440

   (See my previous emails for a generating script)

Tables contain random generated text:

table azjunk7 limit 5;
   txt
--
 i kzzhv ssaa zv x  xlepzxsgbdkxev v wn dmvqkuwb qxkyvgab gpidaosaqbewqimmai  
jxj
 bvwn zbevtzyhibbn hoctxurutn pvlatjjyxf f runa owpltbcunrbq ux peoook 
rxwoscbytz
 bbjlbbhhkivjivklgbh tvapzogh rj ky ahvgkvvlfudotvqapznludohdoyqrp 
kvothyclbckbxu
 hvic gomewbp izsjifqggyqgzcghdat lb kud ltfqaxqxjjom qkw wqggikgvph   yi 
sftmbjt
 edbjfl vtcasudjpgfgjaf swooxygsse flnqd pxzsdmesqhqbzgirswysote muakq agk p w 
uq
(5 rows)

with index on column 'txt':

  create index az7_idx on azjunk7 using gin (txt gin_trgm_ops);

Queries were of the form:

   explain analyze select txt from azjunkXX where txt ~ '$REGEX';

The main problem with the January version was that it chose to use the trgm 
index even when it
could take a long time (hours).  This has been resolved as far as I can see, 
and the results are
now very attractive.

(There does seem to be a very slight regression on the seqscan, but it's so 
small that I'm not yet
sure it's not noise)


Hardware: AMD FX-8120 with Linux 2.6.32-279.14.1.el6.x86_64  x86_64  GNU/Linux

PostgreSQL 
9.3devel-trgm_regex-20121127_2353-e78d288c895bd296e3cb1ca29c7fe2431eef3fcd on
x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.7.2, 64-bit


 port instancetableregex rows method
expl.analyze timing

 6543 HEADazjunk4  x[ae]q  46 Seq Scan 
12.962 ms
 6554 trgm_regex  azjunk4  x[ae]q  46 Bitmap Heap Scan  
0.800 ms

 6543 HEADazjunk4  x[ae]{1}q   46 Seq Scan 
12.487 ms
 6554 trgm_regex  azjunk4  x[ae]{1}q   46 Bitmap Heap Scan  
0.209 ms

 6543 HEADazjunk4  x[ae]{1,1}q 46 Seq Scan 
12.266 ms
 6554 trgm_regex  azjunk4  x[ae]{1,1}q 46 Bitmap Heap Scan  
0.210 ms

 6543 HEADazjunk4  x[ae]{,2}q   0 Seq Scan 
14.322 ms
 6554 trgm_regex  azjunk4  x[ae]{,2}q   0 Bitmap Heap Scan  
0.610 ms

 6543 HEADazjunk4  x[ae]{,10}q  0 Seq Scan 
20.503 ms
 6554 trgm_regex  azjunk4  x[ae]{,10}q  0 Bitmap Heap Scan  
0.511 ms

 6543 HEADazjunk4  x[ae]{1,2}q 49 Seq Scan 
13.060 ms
 6554 trgm_regex  azjunk4  x[ae]{1,2}q 49 Bitmap Heap Scan  
0.429 ms

 6543 HEADazjunk4  x[aei]q 81 Seq Scan 
12.487 ms
 6554 trgm_regex  azjunk4  x[aei]q 81 Bitmap Heap Scan  
0.367 ms

 6543 HEADazjunk4  x[aei]{1}q  81 Seq Scan 
12.132 ms
 6554 trgm_regex  azjunk4  x[aei]{1}q  81 Bitmap Heap Scan  
0.336 ms

 6543 HEADazjunk4  x[aei]{1,1}q81 Seq Scan 
12.168 ms
 6554 trgm_regex  azjunk4  x[aei]{1,1}q81 Bitmap Heap Scan  
0.319 ms

 6543 HEADazjunk4  x[aei]{,2}q  0 Seq Scan 
14.586 ms
 6554 trgm_regex  azjunk4  x[aei]{,2}q  0 Bitmap Heap Scan  
0.621 ms

 6543 HEADazjunk4  x[aei]{,10}q 0 Seq Scan 
20.134 ms
 6554 trgm_regex  azjunk4  x[aei]{,10}q 0 Bitmap Heap Scan  
0.552 ms

 6543 HEADazjunk4  x[aei]{1,2}q89 Seq Scan 
12.553 ms
 6554 trgm_regex  azjunk4  x[aei]{1,2}q89 Bitmap Heap Scan  
0.916 ms

 6543 HEADazjunk4  x[aei]{1,3}q89 Seq Scan 
13.055 ms
 6554 trgm_regex  azjunk4  x[aei]{1,3}q89 Seq Scan 
13.064 ms

 6543 HEADazjunk4  x[aei]q 81 Seq Scan 
11.856 ms
 6554 trgm_regex  azjunk4  x[aei]q 81 Bitmap Heap Scan  
0.398 ms

 6543 HEADazjunk4  x[aei]{1}q  81 Seq Scan 
11.951 ms
 6554 trgm_regex  azjunk4  x[aei]{1}q  81 Bitmap Heap Scan  
0.369 ms

 6543 HEADazjunk4  x[aei]{1,1}q81 Seq Scan 
12.750 ms
 6554 trgm_regex  azjunk4  x[aei

[HACKERS] ERROR: lock 9 is not held

2012-11-09 Thread er
9.3devel / AMD FX-8120 8-core  / centos 6.2 / Linux 2.6.32-279.11.1.el6.x86_64

Hi,

I made a test setup of 9.3devel synchronous replication (git-master as of a few 
hours ago):
two instances on 1 machine:
  master: 93_1  port 6664
  slave:  93_2  port 6665

I do nothing on either server.  I get these logs (note the ERROR-lines in the 
slave log, every 5
minutes) :

$ tail -F 
/home/aardvark/pg_stuff/pg_installations/pgsql.93_1/data/../logfile.93_1
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
LOG:  received smart shutdown request
LOG:  autovacuum launcher shutting down
LOG:  shutting down
LOG:  database system is shut down
2012-11-09 09:42:49.717 CET 6279 LOG:  database system was shut down at 
2012-11-09 09:42:49 CET
2012-11-09 09:42:49.823 CET 6283 LOG:  autovacuum launcher started
2012-11-09 09:42:49.824 CET 6278 LOG:  database system is ready to accept 
connections
2012-11-09 09:42:53.244 CET 6329 LOG:  standby "wal_receiver_01" is now the 
synchronous standby
with priority 1

$ tail -F 
/home/aardvark/pg_stuff/pg_installations/pgsql.93_2/data/../logfile.93_2
cp: cannot stat `/home/aardvark/pg_stuff/archive_dir/00010004': 
No such file or
directory
2012-11-09 09:42:53.144 CET 6328 LOG:  streaming replication successfully 
connected to primary
2012-11-09 09:49:01.124 CET 6323 ERROR:  lock 9 is not held
2012-11-09 09:53:02.427 CET 6323 ERROR:  lock 9 is not held
2012-11-09 09:58:03.845 CET 6323 ERROR:  lock 9 is not held
2012-11-09 10:03:05.239 CET 6323 ERROR:  lock 9 is not held
2012-11-09 10:07:51.620 CET 6323 ERROR:  lock 9 is not held
2012-11-09 10:12:53.019 CET 6323 ERROR:  lock 9 is not held
2012-11-09 10:17:54.416 CET 6323 ERROR:  lock 9 is not held
2012-11-09 10:22:55.811 CET 6323 ERROR:  lock 9 is not held


Master configuration:

data_directory = '/home/aardvark/pg_stuff/pg_installations/pgsql.93_1/data'
listen_addresses = '*'
max_connections = 100
shared_buffers = 128MB
wal_level = hot_standby
synchronous_commit = on
checkpoint_segments = 50
archive_mode = on
archive_command = 'cp %p /home/aardvark/pg_stuff/archive_dir/%f < /dev/null'
max_wal_senders = 3
synchronous_standby_names = '*'


Slave configuration:

data_directory = '/home/aardvark/pg_stuff/pg_installations/pgsql.93_2/data'
listen_addresses = '*'
port = 6665
max_connections = 100
shared_buffers = 128MB
wal_level = hot_standby
synchronous_commit = on
checkpoint_segments = 50
archive_mode = on
archive_command = 'cp %p /home/aardvark/pg_stuff/archive_dir/%f < /dev/null'
max_wal_senders = 3
synchronous_standby_names = ''
hot_standby = on
wal_receiver_status_interval = 59


It's just an ERROR-line in the log, and it may not be a real problem, but in 
any case I'd like to
know how it is caused

(I ought to add that I had not run these build-scripts for testing syncrep for 
a few weeks/months
so I may have missed some developments in setup/config)

thanks,

Erik Rijkers





-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers