equivalent?

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

equivalent?

Postby diggingdeeply » Fri Dec 03, 2010 11:01 am

are these three logically equivalent?

lookup_actions_r.action!=''
NOT lookup_actions_r.action=''
lookup_actions_r.action LIKE '_%'

if so, is one preferable to the other?
diggingdeeply
 
Posts: 34
Joined: Fri Oct 22, 2010 8:57 pm

Re: equivalent?

Postby kraada » Fri Dec 03, 2010 11:57 am

Yes they're logically equivalent. The first two end up being run identically in the code so either one of those is going to be preferrable - using LIKE is always slower than using = or !=, therefore if you can use = it's going to be slightly faster. For the most part the speed increase isn't something you're going to notice directly but since they're logically equivalent you might as well use the faster one.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 0 guests