Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account
List archives

Re: Queries against to-many relationships with 'NOT' subexpressions

Re: Entity Attribute Value model with Cayenne?
(49 lines)
INSERT with raw_sql_query returns error
(29 lines)
Aug 24, 2010
Victor Antonovich
Victor Antonovich
Hello!

24.08.2010 16:05, Aristedes Maniatis wrote:

 You need to create an outer join.

 http://cayenne.apache.org/doc/path-expressions.html


Thanks for the response. AFAIR outer join can widen query results, but I 
need to narrow them excluding joining of group records with same ID.

Could You explain usage of outer join for such case?

Regards,
Victor.


Reply
Tags: joinouter
Messages in this thread
Re: Queries against to-many relationships with 'NOT' subexpressions
Similar Threads
Log queries
Hi, I'm new in the use of mybatis.
Is it possible to create a log for the queries?
I need to log some queries that I pass to Oracle.
Someone could tell me how could I do.

A.


Possible to do $or queries with php 1.0.6 driver
System Configuration:

php driver version = 1.0.6 under MAMP php 5.2
OS X 10.6.4 running mongodb version 1.6.0 64-bit

Using the mongo shell I can successfully run the following $or query:

"db.customers.find( { $or : [ { "Phone 1" : /212/i } , { "Phone 2" : /
21/i} ] } )"

Trying to do this in php I run into some issues ( Fatal error:
Uncaught exception 'MongoCursorException' with message '$or requires
nonempty array' ) .

Here is the php query I'm trying :

$query = array( "\$or" => array( "Phone 1" => new MongoRegex("/212/
i") , "Phone 2" => new MongoRegex("/21/i") )  );

$db_con = $db_con->find($query);

Maybe I'm formatting this incorrectly, any ideas?

I'm also seeing this in the mongo log file:

Thu Aug  5 22:46:20 [conn52] Assertion: 13262:$or requires nonempty
array
0x10007c7f2 0x10005981c 0x1002a7aa7 0x100136356 0x10025f360
0x100266145 0x10039b422 0x1003acf94 0x7fff85c79456 0x7fff85c79309
 0   mongod                              0x000000010007c7f2
_ZN5mongo11msgassertedEiPKc + 354
 1   mongod                              0x000000010005981c
_ZN5mongo15FieldRangeOrSetC2EPKcRKNS_7BSONObjEb + 252
 2   mongod                              0x00000001002a7aa7
_ZN5mongo16MultiPlanScannerC2EPKcRKNS_7BSONObjES5_PKNS_11BSONElementEbS5_S5_bb
+ 215
 3   mongod                              0x0000000100136356
_ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ +
2518
 4   mongod                              0x000000010025f360
_ZN5mongo13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE +
608
 5   mongod                              0x0000000100266145
_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_8SockAddrE
+ 5029
 6   mongod                              0x000000010039b422
_ZN5mongo10connThreadEPNS_13MessagingPortE + 562
 7   mongod                              0x00000001003acf94
thread_proxy + 132
 8   libSystem.B.dylib                   0x00007fff85c79456
_pthread_start + 331
 9   libSystem.B.dylib                   0x00007fff85c79309
thread_start + 13






Queries regarding memcache
Hi,

I am using memcache on windows. I have installed the following version
memcache server:
memcached-win32-1.4.4-54-g136cb6e.zip


And the client gem is:

memcache-client-1.8.5.gem

My App is a JRuby on rails application

I have configured to use memcache through this configuration:

config.cache_store = :mem_cache_store

And i use it normally, a small code snippet is as follows:
          def data_cache(key)
            unless output = Rails.cache.read(key)
              output = yield
              Rails.cache.write(key, output)
            end
            return output
          end

However i continuously get the following error in my logs:

MemCacheError (No connection to server (localhost:11211 DEAD
(Errno::EAGAIN: Resource temporarily unavailable - ), will retry at
Mon Jul 26 12:35:23 +0530 2010)): No connection to server (localhost:
11211 DEAD (Errno::EAGAIN: Resource temporarily unavailable - ), will
retry at Mon Jul 26 12:35:23 +0530 2010)

However i get the ouput, but i am not sure if the output is coming
from cache or my backing store ie database.

Also i would like to know how to configure memcache as a write through
cache.

Environment:

Jruby version 1.5.0
Rails version 2.3.5
Postgre SQL database 8.3
apache-tomcat-6.0.26


Thank you



How can I trace mongoDB queries
Hi guys,

I'm running mongodb server as a windows service. How can i connect to
it via console to trace executed queries?

Best regards,
Alexey Zakharov





Redis (1.2.6) : Slow queries
Hi All,

We are using Redis 1.2.6 in production environment. There are 161804
keys in redis. Machine has 2GB RAM.

Problem:

Select queries to Redis are taking 0.02 sec on an average. But some
times they take 1.5-2.0 secs, I think whenever redis save modified
keys on disk.

One strange thing I noticed before and after restarting the redis is
that:

Before restart "changes_since_last_save" changing too fast and was
reaching 3000+ (in 5 minutes). But after restart
"changes_since_last_save" remains below 20 or so.

Redis stats before restart:

 
{:bgrewriteaof_in_progress=>"0", :arch_bits=>"64",
:used_memory=>"53288487", :total_connections_received=>"586171",
:multiplexing_api=>"epoll", :used_memory_human=>"50.82M",
:total_commands_processed=>"54714152", :uptime_in_seconds=>"1629606",
:changes_since_last_save=>"3142", :role=>"master",
:uptime_in_days=>"18", :bgsave_in_progress=>"0",
:db0=>"keys=161863,expires=10614", :connected_clients=>"13",
:last_save_time=>"1280912841", :redis_version=>"1.2.6",
:connected_slaves=>"1"}

Redis stats after restart:

 
{:used_memory_human=>"49.92M", :total_commands_processed=>"6012",
:uptime_in_seconds=>"1872", :changes_since_last_save=>"2",
:role=>"master", :uptime_in_days=>"0", :bgsave_in_progress=>"0",
:db0=>"keys=161823,expires=10464", :connected_clients=>"13",
:last_save_time=>"1280917477", :redis_version=>"1.2.6",
:connected_slaves=>"1", :bgrewriteaof_in_progress=>"0",
:arch_bits=>"64", :used_memory=>"52341658",
:total_connections_received=>"252", :multiplexing_api=>"epoll"}


Not sure what is going wrong here.

Thanks in advance.

Sunil





queries with temp tables
hello,

I want to check if it is possible to fill temp tables and then use
them in a select/insert/update query mapped simply in ibatis.

for example: a complex select needs a temp table, the values injected
into the temp table are coming from a remotely connected (linked)
server. After filling the temp table it is used in join with a local
table to produce a single or multiple result sets.

is there a best way to fill temp tables for statements mapped in
ibatis? possibly in the select/insert/update tag itself?

Thank you,


running map-reduce queries in Clojure
Hi all,

For learning Clojure I started a pet project to communicate Clojure and
Erlang using JInterface. To test that project I wrote a small and dirty
server that can run map-reduce queries in Clojure.

I've come up with a very basic proof of concept that is described here:

http://videlalvaro.github.com/2010/08...s-in-clojure.html

I don't know up to where this will work, If it is performant enough, or if
is just convenient for Clojure people using riak, etc.

So please take it as it is. There are some TODOs that I mention in that
blog post that I will try to address in the upcoming days.

If you think this could be useful for your project let me know and share
your thoughts.

Regards,

Alvaro

Slow queries and Indexing Problems
We are having several issues with the queries and developing an
indexing strategy for a query like:

query: { timestamp: { $lte: 1280752012610 }, query_tags: { $in: { 0:
"group_id-10-0-1" } }, source_group_id: { $in: { 0: 551, 1: 408, 2:
285, 3: 9058, 4: 9242, 5: 562, 6: 9370, 7: 9064, 8: 9368, 9: 572, 10:
26, 11: 149, 12: 9043, 13: 33, 14: 9249, 15: 43, 16: 9026, 17: 9027,
18: 55, 19: 9032, 20: 419, 21: 9403, 22: 9037, 23: 9012, 24: 9011, 25:
9010, 26: 79, 27: 73, 28: 9018, 29: 9017, 30: 9016, 31: 85, 32: 83,
33: 92, 34: 9125, 35: 9004, 36: 89, 37: 9299, 38: 9003, 39: 90, 40:
587, 41: 226, 42: 594, 43: 115 } } }, orderby: { pubdate: -1 } }

1.  We use a range key and sort key in query in the query.  Looks like
this causes indexing misses.
2. We have two arrays within an index put into a composite index but
this too is a problem.

Are there workarounds to create an index that the query will pick up?
How effective is an index on queries that have a large $in statements?

Help.





Re: patch for serving get_paths queries when the master DB is down
Hey,

Did you ever figure this out?

You can base your patch against 2.36 or svn, and svn is linked in a few
places, but it's at: http://code.sixapart.com/

should probably put a redirect in the google code svn... but we're
supposed to move to git "any day now"

On Wed, 14 Jul 2010, Martijn Lina wrote:

 Hi Dormando,

 Now i feel stupid, the uploaded patch is indeed missing most of my
read-only
 patches! Maybe i should open a new thread with the correct patch,
this thread
 has turned into martijn's patch-upload-stupidity thread ;)

 Thanks a lot for your response, i'll upload the full patch later this
day in a
 new thread. Should i make a patch against 2.36 or should i use the
latest
 checkout and if so, where is the repository? I looked on google code,
but
 http://mogile.googlecode.com/svn/trunk/ is completely empty..

 bye,
 Martijn

 Once upon a 10 Jul 2010, dormando  hit keys in the following order:
 > Hey,
 >
 > Is this patch missing parts? It seems to create a bunch of
variables which
 > aren't reused and then changes which DB the JobMaster worker
uses...
 >
 > With respects to what I can see so far, you can't do that to the
job
 > master... That guy absolutely needs to coordinate against the
master
 > server, and the only queries it does are transactional and as
large as
 > possible to minimize latency.
 >
 > So if the master is down, the JobMasters should not be able to
fetch more
 > work.
 >
 > Your note on the caches not working so well is probably right. I
figured
 > out a few months ago that a lot of the worker caches (for
devices, hosts,
 > etc) are almost constantly being invalidated. I think the slave
settings
 > might also end up being read constantly...
 >
 > I added a new method of caching configuration data that's used
in
 > JobMaster which caches data a lot harder. Should use/base
something else
 > off of that.
 >
 > -Dormando
 >
 > On Sun, 4 Jul 2010, Martijn Lina wrote:
 >
 > > Okay, here it is
 > >
 > > thanks
 > > Martijn.
 > >
 > > Once upon a 02 Jul 2010, dormando  hit keys in the
following order:
 > > > You should attach it to the actual e-mail you're
sending.. I'm not sure
 > > > offhand why uploading files to the group doesn't work.
Best to put it in
 > > > the e-mail anyway.
 > > >
 > > > On Fri, 2 Jul 2010, martijn wrote:
 > > >
 > > > > I've uploaded this patch twice but it keeps being
deleted, without
 > > > > anybody telling me why. Is it that bad?
 > > > >
 > > > > bye
 > > > > Martijn
 > > > >
 > >



Syntax and Semantics for Continuous queries in Hive
Hello,

I am curious whether large streaming data can be queried by syantax and
semantics of continuous queries inside Hive as defined in Streams Databases
(e.g. StreamBase, Coral8 etc.).  Continuous queries are essential for
real-time enterprise, log data and many other applications.

Thanks,
Shyam Sarkar



      



Thoughts on adding complex queries to Cassandra
Are there any thoughts on adding a more complex query to Cassandra?

At a high level what I'm wondering is: Would it be possible/desirable/in
keeping with the Cassandra plan, to add something like a javascript blob
on
to a get range slice etc, that does some further filtering on the results
before returning them. The goal being to trade off some CPU on Cassandra
for
network bandwidth.

-JD


is mapreduce query option optimized like normal queries?
running a query with sort and limit(1) takes 31ms, while running the
same in a mapreduce (by using the query, sort, limit options) takes
more than 1 second. creating a temporal collection cannot possibly
take that much time, so maybe the query runs unoptimized in mapreduce?





DO NOT REPLY Stale LDAP connections take 15+ minutes to finish queries
https://issues.apache.org/bugzilla/show_bug.cgi?id=45834

Stefan Fritsch <s### @sfritsch.de> changed:

           What    |Removed                     |Added

Production issues - 1. long running queries, 2. occasional large wait spikes on box
Hi,

I'm seeing a lot of long running queries on our production instance.
We are running : Mongo 1.4.3 on centOS box on EC2 on a xlarge
instance.

1.  We have done a lot work on indexing queries and saw some good
results but now some queries running slow (1 to 5 secs), especially
for getmore queries.  I also see slowness when we are running large
amount of read and write queries concurrently.  (We are dealing with
this by using our slave as our read server but this has not switched
yet)

2.  We are also seeing occasionally large wait spikes on the box.  Was
wondering if this due  index swapping?

Help.

I'm including our db.serverStatus():
 db.serverStatus(){
	"version" : "1.4.3",
	"uptime" : 1264594,
	"localTime" : "Wed Aug 18 2010 08:51:21 GMT-0700 (PDT)",
	"globalLock" : {
		"totalTime" : 1264593956377,
		"lockTime" : 91572729593,
		"ratio" : 0.07241275282965245
	},
	"mem" : {
		"bits" : 64,
		"resident" : 15826,
		"virtual" : 64142,
		"supported" : true,
		"mapped" : 56471
	},
	"connections" : {
		"current" : 704,
		"available" : 19296
	},
	"extra_info" : {
		"note" : "fields vary by platform",
		"heap_usage_bytes" : 9739824,
		"page_faults" : 6122670
	},
	"indexCounters" : {
		"btree" : {
			"accesses" : 21315629,
			"hits" : 21311553,
			"misses" : 4076,
			"resets" : 0,
			"missRatio" : 0.0001912211926751024
		}
	},
	"backgroundFlushing" : {
		"flushes" : 21273,
		"total_ms" : 58220455,
		"average_ms" : 2736.8239082404925,
		"last_ms" : 2411,
		"last_finished" : "Wed Aug 18 2010 08:50:25 GMT-0700 (PDT)"
	},
	"repl" : {
		"ismaster" : 1,
		"msg" : "not paired"
	},
	"opcounters" : {
		"insert" : 1483988,
		"query" : 88204237,
		"update" : 189641601,
		"delete" : 391496,
		"getmore" : 17352309,
		"command" : 9907185
	},
	"asserts" : {
		"regular" : 1,
		"warning" : 9,
		"msg" : 0,
		"user" : 8060,
		"rollovers" : 0
	},
	"ok" : 1
}





Created: (HIVE-1468) intermediate data produced for select queries ignores hive.exec.compress.interm
intermediate data produced for select queries ignores
hive.exec.compress.intermediate

How to reuse "queries" in mapper xml file ?
Hi,

Still struggling to see how I can refactor my batis code (which is
getting quite verbose). Is there a way to reuse query in Mapper.xml ?

For instance, let say I want to statically reuse a select ... from and
then append different "where" clauses to it :

<mapper namespace="...">
    <select id="findAll" resultMap="RM">
        select a.x, a.y, a.z ....(another ten fields or so)
            b.id as b_id, ... (another ten fields or so)
        from EntityA a
        left outer join EntityB b on a.id= b.id
    </select>
    <select id="findById"  parameterType="int"
resultMap="EnterpriseRM">
        REUSE "findAll" query and add
        where e.id = #{id}

    </select>

Thanks for your help.