Question

I have a query in Sybase IQ 12.7 that looks like:

select ip from iplookup where ip in (select ip from persisted_info)

where iplookup is defined as a single column.

I saw the IN and subquery and decided that must be slow (full table scan) and that this would be preferred:

select lk.ip from iplookup lk, persisted_info ps where lk.ip = ps.ip

but I want to be careful and get some evidence to back me up. Sybase IQ does not support EXPLAIN PLAN and using SET STATISTICS TIME ON returns a syntax error.

To resolve this, I would like to know how to get either:

  1. timing information
  2. execution plan information

Edit: I am using sqsh from a Mac to talk to Sybase and I get extra information in the response when I add SET STATISTICS IO ON ahead of the query.

Was it helpful?

Solution

I think you're looking for (edited syntax, I was in ASE mode)

set TEMPORARY OPTION NOEXEC = on;
set TEMPORARY OPTION QUERY_PLAN = on;
set TEMPORARY OPTION QUERY_TIMING = on;

These write to the server log, which i'm not sure you have access to. If you can live without exact IO and timing statistics, then you won't need access to the server logs and can do what's below...

If you're on @@version 12.7 ESD3 or later, you should be able to do either of the following two queries and put the output into an .html or .xml file and view it.

--XML
SELECT GRAPHICAL_PLAN ('select * from t1 where ip in (select ip from t2)')
--HTML
SELECT HTML_PLAN ('select * from t1 where ip in (select ip from t2)')

Link for more info: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc74603.1270/html/iqrbwin/CIHEFAIF.htm

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top